06.10.2016 Views

laravel-5

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Upgrade Guide 42<br />

The App\Providers\ConfigServiceProvider may be removed from your service provider list in<br />

your app.php configuration file.<br />

Upgrading To 5.0 From 4.2 {#upgrade-upgrade-5.0}<br />

Fresh Install, Then Migrate<br />

The recommended method of upgrading is to create a new Laravel 5.0 install and then to copy your<br />

4.2 site’s unique application files into the new application. This would include controllers, routes,<br />

Eloquent models, Artisan commands, assets, and other code specific files to your application.<br />

To start, install a new Laravel 5.0 application into a fresh directory in your local environment. Do<br />

not install any versions newer than 5.0 yet, since we need to complete the migration steps for 5.0<br />

first. We’ll discuss each piece of the migration process in further detail below.<br />

Composer Dependencies & Packages<br />

Don’t forget to copy any additional Composer dependencies into your 5.0 application. This includes<br />

third-party code such as SDKs.<br />

Some Laravel-specific packages may not be compatible with Laravel 5 on initial release. Check with<br />

your package’s maintainer to determine the proper version of the package for Laravel 5. Once you<br />

have added any additional Composer dependencies your application needs, run composer update.<br />

Namespacing<br />

By default, Laravel 4 applications did not utilize namespacing within your application code. So, for<br />

example, all Eloquent models and controllers simply lived in the “global” namespace. For a quicker<br />

migration, you can simply leave these classes in the global namespace in Laravel 5 as well.<br />

Configuration<br />

Migrating Environment Variables<br />

Copy the new .env.example file to .env, which is the 5.0 equivalent of the old .env.php file. Set<br />

any appropriate values there, like your APP_ENV and APP_KEY (your encryption key), your database<br />

credentials, and your cache and session drivers.<br />

Additionally, copy any custom values you had in your old .env.php file and place them in both<br />

.env (the real value for your local environment) and .env.example (a sample instructional value for<br />

other team members).<br />

For more information on environment configuration, view the full documentation.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!