Installing from Packagist using Composer

If you have Composer already installed, then to install a PHP package from Packagist, such as Generators package for Laravel, type the following on the terminal in your web project directory:

$ composer require ways/generators

You will be asked about the version of the package that needs to be installed:

Please provide a version constraint for the way/generators requirement: 1.0.*

I required the latest, which was 1.0.x-dev; so something like 1.0.* would get the latest one in 1.0 branch.

Composer will install the dependencies first, and then install the required package:

composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  – Installing mockery/mockery (dev-master 28c7769)
  Cloning 28c77695ac5167e533f86e0268c0a83ef1ac693a

  – Installing way/laravel-test-helpers (dev-master 869388b)
  Cloning 869388b555c68c0dc74297eca83893c8500d8221

  – Installing mustache/mustache (dev-master v2.3.1)
  Cloning v2.3.1

  – Installing way/generators (dev-master a04a2c9)
  Cloning a04a2c9cf6704f107f1a4e534d898d46f076d3de

Writing lock file
Generating autoload files
Generating optimized class loader…
Compiling common classes…

That’s it. The package has been installed in your web project. In your Laravel app, it gets installed inside the vendor directory.

Leave a Reply

Your email address will not be published. Required fields are marked *