Skip to content

PHP Composer chef recipe to install composer and packages.

Notifications You must be signed in to change notification settings

ryross/composer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP composer chef recipe

Author: Michael Klapper <[email protected]>
Description:Chef recipe to manage/install composer packages
Homepage:http://www.morphodo.com
Tags:PHP, Composer

This way composer is installed under /opt/composer, the binary is symlinked into /usr/local/bin.

include_recipe "composer"

To install composer locally for just a project you can use the LWRP as below.

composer "/var/www/domain/htdocs" do
  global false
  action :install
end

This command will download composer to the htdocs directory /var/www/domain/htdocs/composer.phar.

Just pass the path to the composer installation to the LWRP and call the update action.

composer "/var/www/domain/htdocs" do
  action :update
end

Manage composer packages from Packagist with existing composer.json configuration file

From existing /var/www/domain/htdocs/composer.json file with option --dev set.

composer_package "/var/www/domain/htdocs" do
  action :install
  dev true
end

This will update all configured packages from composer.json.

composer_package "/var/www/domain/htdocs" do
  action :update
end

You can use Composer to create new projects from an existing package. This is the equivalent of doing a git clone/svn checkout followed by a composer install of the vendors.

The directory is not allowed to exist, it will be created during installation.

composer_package "typo3/neos-base-distribution" do
  action :create_project
  install_path "/var/www/neos
end

You can simply use the create action to build a new composer.json file from template and define which packages you would like to install.

composer_package "Install PHP tools for development" do
  action [:create, :update]
  install_path "/opt/composer-libaries"
  packages ({"phpunit/phpunit" => "3.7.*", "phing/phing" => "2.4.*"})
  config ({"bin-dir" => "/usr/local/bin"})
end

If you need to update the autoloader because of new classes in a classmap package for example, you can use "dump-autoload" to do that without having to go through an install or update.

Additionally, it can dump an optimized autoloader that converts PSR-0 packages into classmap ones for performance reasons. In large applications with many classes, the autoloader can take up a substantial portion of every request's time. Using classmaps for everything is less convenient in development, but using this option you can still use PSR-0 for convenience and classmaps for performance.

composer_package "/opt/composer-libaries" do
  action :dump_autoload
  optimize true
end

This cookbook is used to manage the PHP development dependencies easily for PylonWorks.Essencebase sandbox environment.

About

PHP Composer chef recipe to install composer and packages.

Resources

Stars

Watchers

Forks

Packages

No packages published