Laravel Upgrade From 5.6 to Laravel 6 - php

I have a Project https://github.com/javedbaloch4/Laravel-Booking developed in Laravel 5.6 now I want to upgrade it to Laravel 6. What are the steps can I directly update to 6 or first goto 5.7, 5.8 and then.
Please can guide the steps here for a quickly upgrade Thanks.

Step 1 : Remove the followings from your composer.json file
"laravelcollective/html": "^5.4.0",
"yajra/laravel-datatables-oracle": "^8.4"
Step 2 : Replace this line
"laravel/framework": "5.6.*",
To this
"laravel/framework": "^6.0",
Step 3 : Run Following commands in order
composer require laravel/helpers
composer require laravelcollective/html
composer require yajra/laravel-datatables-oracle
composer require yajra/laravel-datatables-buttons
composer require yajra/laravel-datatables-html
composer require yajra/laravel-datatables-fractal
composer require yajra/laravel-datatables-editor
composer update
composer dumpa
Key Point to notice and understand is whenever you want to upgrade
make sure all the packages you're using have compatibility with correct versions of laravel and php. Check and follow the repo. on git to get notified if any new upgrades are there.
That's It, You're Good to go.

The official framework documentation tells you exactly how to upgrade:
https://laravel.com/docs/5.7/upgrade
https://laravel.com/docs/5.8/upgrade
https://laravel.com/docs/6.x/upgrade
https://laravel.com/docs/7.x/upgrade

You can also use https://laravelshift.com if you need any automatized solution.

Related

Unable to install symfony/console:3.2 via composer and flex

I have a Symfony 4 project and am trying to install this package for working with AWS DynamoDB.
When I run composer require oasis/dynamodb-odm I get an error saying oasis/dynamodb-odm v0.5.3 requires symfony/console ^3.2 -> no matching package found. Attempting to run composer require symfony/console:^3.2 also results in the "Could not find package..." error.
As I am using Symfony 4, composer commands are intercepted by Symfony Flex and some extra stuff happens. Interestingly, there is a Flex recipe for symfony/console:3.3 but not 3.2 which I imagine might be the problem.
My understanding of the caret is that it should allow minor version bumps, so I wonder why console v3.3 is not installed instead.
I would like to use this package, and there aren't many DynamoDB PHP offerings out there, so how can I resolve this issue?
if you checkout the composer.json file of the package, you can see the following
"require" : {
"php" : ">=5.6",
"doctrine/annotations": "^1.4",
"oasis/aws-wrappers" : "^2.10",
"oasis/logging" : "^1.0",
"doctrine/common" : "^2.7",
"symfony/console" : "^3.2",
"symfony/finder" : "^3.2"
},
meaning it is compatible with symfony3 only.
Probably you can fork the repo and try changing the version numbers and test it. If it works you can install it.

Adding Monolog to PHP 5.6 Project

Im trying to add Monolog to a project which is running PHP version 5.6.3 and therefore its detecting the version and reverting.
On the documentation it saying
use Monolog ^1.0 for PHP 5.3+ support.
But I dont understand how is accomplished as a composer command.
Add this line in your composer.json file (in require section):
"monolog/monolog": "^1.0"
Then run composer install and you should be good to go!

Adding Guzzle For Mailgun in Laravel 5

I want to use the Mailgun service in Laravel 5. This requires Guzzle 5 to be installed. I've added the following to composer.json, and installed it:
"guzzlehttp/guzzle": "~5.0"
However, my app is giving me this error:
FatalErrorException in MailgunTransport.php line 121:
Class 'GuzzleHttp\Client' not found
I've ran composer dump-autoload. What am I missing? Thanks.
I solve this by using:
"laravel/framework": "5.0.16",
"guzzlehttp/guzzle": "5.2",
composer update
and that is all.
composer install installs the packages (including exact versions) listed in composer.lock. When adding a new package or changing the version requirements, you need composer update (or you can use composer require) as the new package isn't in the lock file yet.
Running composer install when the composer.json has been updated since the last update/require should generate a warning saying Warning: The lock file is not up to date with the latest changes in composer.json, you may be getting outdated dependencies, run update to update them.

Laravel 4 Package installation using composer

I need to know how to install packages in laravel 4.
I have downloaded a bundle from github, but executing the bundle, I see it is deprecated in Laravel 4. Can anyone please help me.
Just using packagist, you can go to packagist.org , after that just put the package name at require key in your composer.json on your laravel project, and that run this command , composer update or compose install
in example :
// composer.json
"require": {
// default value..
"intervention/image": "dev-master",
}
i hope this help
Laravel 4 now uses composer to install packages.
You can add new packages to laravel via a few options on composer. One is on the command line.
> composer require author/package
> dev-master
After issuing the require command it will ask you what version to use. then run composer update, add the PackageServiceProvider to your app/config/app.php
First and always if you plan to use composer in your work, learn the basics of it (what is composer.json,composer.lock...)
There is excellent video on Laracasts https://laracasts.com/lessons/you-must-use-composer
That way you can avoid problems and enjoy using this great package manager.
Next use composer dump(-autoload) command frequently and composer self-update.
If that bundle is deprecated in Laravel4 than it is deprecated and you can't use it ( unless author made some changes and adopt it for l4 )
Also bundle is a l3 specific type and in l4 we have packages.
Ok, you can't execute composer commands on windows command prompt. mac/linux terminal would do but if you insist on using windows then install this [https://www.cygwin.com/] so you could issue unix commands

Remove SonataPageBundle or Install a fresh Symfony2 with SonataAdmin project

I downloaded and setup an Sonata's Sonata-Sandbox Bundle for Symfony2. I'm using Symfony 2.2.2. It's a good package and contains mostly used packages installed.
After installation I decided not to use SonataPageBundle that's included in package because it overrides all my Bundle's but unable to remove it.
I tried to remove it from composer.json and tried a php composer.phar update but no luck, update is always failing because of the dependency other libraries.
Actually, I need SonataAdminBundle with Media library on any version of Symfony 2.x. I found other solutions to install Symfony 2 + SonataAdminBundle + etc but they are also failing on different version support in composer.json and could't make a successful installation manually.
I'm on Mac 10.8 and BitNapi MAMP Stack 5.4.15-0 with PHP 5.3
Are there any better ways to install these extensions to Symfony 2?
Yes, you can use composer to install only the Sonata bundles you need. Here's mine, which is about as short as it gets for Sonata using Doctrine:
"require": {
"sonata-project/admin-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/user-bundle": "dev-master",
"sonata-project/media-bundle": "dev-master"
}
If you haven't actually started coding anything, you might want to start a new project because removing PageBundle is slightly tedious and reinstalling using this guide is simple and basically three simple steps:
Install composer:
curl -s https://getcomposer.org/installer | php
Download Symfony2:
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.3.0
Then you can add the bundles you need in composer.json and run
php composer.phar update

Categories