Adding Monolog to PHP 5.6 Project - php

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!

Related

Laravel Upgrade From 5.6 to Laravel 6

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.

Upgrading Laravel 5.4 to latest version (5.7)

I am working on Laravel 5.4 with PHP version 5.6.4.
My goal is to upgrade my project to Laravel 5.7 with PHP 7.1.
Now my question is: Do I have to upgrade to 5.5 > 5.6 > 5.7 or can I go directly from 5.4 to 5.7?
There are some articles on documentation. You can upgrade to 5.7 directly but be sure to modify critical sections from this links 5.5->5.6, 5.6->5.7. And make a backup of current project first
Better to upgrade 5.5 first an then go with 5.6 and 5.7 because if you see in 5.5 and 5.6 upgrade guide there are some packages also need to upgrade so you better go with the step by step.
5.4 to 5.5
5.5 to 5.6
5.6 to 5.7
For older versions, you can look at
5.3 to 5.4
4.2 to 5.3
From my point of view, it would help to upgrade step by step. This helps to to see whether your application is already compatible with all changes that need to be made.
If you upgrade to 5.7 directly and face larger problems due to the changes, your quickest option is to downgrade to 5.4 again.
If you upgrade to 5.5 in the first step, you can make your application compatible to 5.5, test it thoroughly, deploy it, and start to test what needs to be done for the upgrade to 5.6.
Just update your laravel/framework dependency to 5.7.* in your composer.json file. Since you are upgrading from 5.4 to 5.7, then you can easily just run
composer update
And if you modified some of Laravel's Traits or Methods in your 5.4 application, then you can check here for more info
Just update your laravel/framework dependency to 5.7.* in your composer.json file:
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.7.*",
"laravel/tinker": "^1.0"
},
After, run this command on your command prompt: composer update
You will achieve success and your Larvael will change to version 5.7, more details are available on upgrade guide
No,you sholud not upgrade step by step, only you can do this :
https://laravel.com/docs/5.7/upgrade
For updating Laravel 6.x (Which means any subversions to V6)
Just run this command
cd [laravel installation directory]
composer update
You must have composer installed on your VM or PC.
For Linux users only:
Composer directory must be owned by current user
//Check ownership
ls -la ~/ | grep ".composer"
//If you don't own the directory
chown -R [user]/[user] ~/.composer
Message me on any social media #smitpatelx Or leave a comment if you need any help or if your usecase differ from the above.

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.

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

Bundle not found when updating from Symfony 2.0 to Symfony2.1 via composer

I'm updating my app from Symfony2.0 to Symfony2.1.
When I run composer install I receive a fatal exception about JMS/SerializerBundle not being found when it reaches the generating autoload files step. I think cache:clear is causing this.
I've added it to composer.json:
"jms/serializer-bundle": "dev-master",
And in my appKernel:
new JMS\SerializerBundle\JMSSerializerBundle($this),
I basically followed the steps.
I also can not find the file in the vendor directory. The composer stated 'Nothing to install or update' though. It does not matter if I put in a version number. Think this is the same for the stof doctrine extension.
How do I resolve this?
Setting symfony to 2.1.0 allowed me to install the extra repositories.

Categories