Shift with red gradient lettering

Consolidate Namespaces Shifts

The Consolidate Namespaces Shift consolidates custom PSR-0 and PSR-4 namespaces with the default Laravel 5 application namespace.

Custom namespaces were needed prior to Laravel 5 as earlier versions of Laravel did not use namespaces. Now that Laravel 5 has a default application namespace, there is rarely a need to separate your code into its own custom namespace.

Consolidating custom namespaces simplifies your Laravel application architecture and configuration. Both of which make your Laravel application easier to maintain and upgrade.

Screenshot of a pull request with automated changes from the Consolidate Namespaces Shift

Requirements

A Laravel application running Laravel 5.0 or higher. If your Laravel application is running Laravel 4.2, run the Laravel 5.0 Shift first.

Automated Changes

The Consolidate Namespaces Shift consolidates any custom PSR-0 and PSR-4 namespace underneath the app/ folder, including:

  • Moving classes to their respective code Laravel folder.
  • Migrating classes within the Controllers/ folder to the Laravel 5 app/Http/Controllers/ folder.
  • Migrating classes within the Models/ folder to the Laravel 5 app/ folder.
  • Creating new folders not present in the default Laravel folder structure.
  • Updating references to custom namespace to the default Laravel namespace.
  • Removing the custom namespace from the Composer autoload configuration.

Sign in with any of the following services to connect Shift with your Laravel project.


Don't use one of these services?

Temporarily push your project to a free, private repository on one of these cloud-based services or upgrade your project locally with Shift for Docker.