When installing Guzzle via Composer where do I place the require vendor/autoload.php - laravel

Following the install instructions for composer here:
https://github.com/guzzle/guzzle
Next, run the Composer command to install the latest stable version of Guzzle:
composer require guzzlehttp/guzzle
This is straight forward and works.
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
I'm not sure about where to require the autoloader. Can anyone point me in the right direction.
Guzzle appears to work without this step but I'm looking for some clarification if this is needed and if so where to add the require.
I'm using Laravel 4.2 btw.
Thanks in advance.

If you're using Laravel 4.2 you don't need to do anything.
Laravel 4.2 automatically includes composer autoloader for you so you don't have to. If you were writing stand alone scripts, or your own framework, you'd need to require the autoloader yourself.
(Also, if the autoloader wasn't required, you wouldn't be able to instantiate Guzzle classes with manually requiring or including the files)

Related

composer require reading all version of all package, and take too many time

I'm using OroCommerce and want to add a new packge using composer require
Before install my wanted package, composer display message like this
Reading composer.json of {package_name} ({version})
Composer seems to read all version of all my installed package.
It take so many time to read all version (by example package oroinc/platform have 199 releases)
There is a way to prevent this behavior
I answer myself (in case someone as the same question)
It's no possible https://github.com/composer/composer/issues/5943

Composer - how to autoload only needed modules

While using composer autoload function, I faced annoying case.
For example for following situation:
I have 10 modules installed so far, and in the specific PHP, I just
want to load only needed module with it's dependencies.
What can I do?
If I do
require "composer/vendor/autoload.php";
it will load all modules' name space, and I DO NOT WANT THAT!
So let me explain exact sample case.
I have a Facebook SDK v4.0, which I manually downloaded last time. And there is code snap in, let say, a.php which is using this, by following code:
require 'facebook_v4/autoload.php';
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\GraphUser;
use Facebook\FacebookRequestException;
Now, I have downloaded Facebook SDK v5 just by composer, with running following command:
composer require facebook/graph-sdk
And because I need to use other modules downloaded via composer, I added following line at very fist line of the a.php file:
require "composer/vendor/autoload.php";
Now it turns out it totally uses Facebook SDK v5 instead of v4, that 's why I just want to know the way to load ONLY needed modules by composer.
Please help me to figure out this case.
Thank you.

How to update CodeIgniter with Composer?

I switched from Symfony to CodeIgniter and I would like it to stay up-to-date with the framework.
I understand that you can easely install and update all kind of packages, I know how to do it as I did it over and over again with Symfony.
I already set $config['composer_autoload'] = TRUE; in application/config/config.php. (Thanks to a lot of other SO questions)
My problem: Composer seems to update all the packages fine, but not the framework itself. Is it possible or am I doomed to do it manually?
EDIT
Please consider using CodeIgniter 4, which is made to be used with Composer from the start. CodeIgniter 3 is old and should only be used on legacy projects.
You can update your codeigniter using composer by below method:
$ cd /path/to/codeigniter
$ composer update
Here you can get more info about this
CodeIgniter hasn't been made as a composer packageā€¦ except that someone eventually did it anyway!
It is possible to keep CodeIgniter up-to-date by installing it throught composer in the first place. The project is hosted on GitHub.
In order to use it, it's quite easy: composer create-project kenjis/codeigniter-composer-installer codeigniter should do the trick!

How to install libraries without composer in drupal 8

In drupal 8, I am encountering modules that require libraries to be installed by Composer. However, I was wondering if I could skip the composer part and just install the libraries by hand.
Would I ever be able to do this?
(I have never gotten Composer to work)
Just extract the library at /libraries.
For colorbox, you should have root/libraries/colorbox/jquery.colorbox-min.js
But this way you miss the main purpose of composer cause it won't be possible to update all the dependence automatically.

What is the difference between composer in ballerina and composer used for laravel installation?

I have installed the ballerina-tools-0.95.6 some days ago. It uses composer to provide a browser based developer tool. Now I try to install laravel. The instalation guide directs me to install composer and use that to install laravel. Now I have a confusion. Are both composers same or different? If both are different ,then what are the differences?What are the roles of these both composers?
They're two completely different things. :)
Ballerina and PHP are different programming languages. While both have tools called "composer", the Ballerina Composer is a browser-based Ballerina program manager, and the PHP Composer is a dependency manager for PHP.
Laravel is built in PHP and has absolutely nothing to do with Ballerina. The composer you want is available here: https://getcomposer.org

Resources