Your SlideShare is downloading. ×
0
Composer
Composer
Composer
Composer
Composer
Composer
Composer
Composer
Composer
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Composer

307

Published on

Tool to manage dependency packages in your project

Tool to manage dependency packages in your project

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
307
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Project Dependencies Project that depends on a number of libraries. Libraries depend on other libraries. Declare the things you depend on. Composer which packages which versions installs them (meaning it downloads them into your project).
  • 2. ● ● Command-line utility Inspired by npm and bundler ● ● Dependency manager Not package manager What is Composer? ● ● Download project dependencies Set autoloading ● ● Composer compatible Php Libraries Packagist
  • 3. System Requirements ● PHP 5.3.2+ ● php settings and compile flags ● git, svn or hg ● Composer is multi-platform
  • 4. Installation ● Can be installed locally i.e in your working directory ● Recommended to install globally (/usr/local/bin) ● Interactive Installation : curl -s https://getcomposer.org/installer | php Run the installer. ● Manual Installation : curl -s https://getcomposer.org/composer.phar -o $HOME/local/bin/composer chmod +x $HOME/local/bin/composer
  • 5. Using Composer ● composer require phpunit/phpunit:3.9 ● composer.json ● “require” key ○ { “require” : {“monolog/monolog” : “dev-master#12”} “require” : { “phpunit/phpunit” : “3.9.*@dev” "prefer-stable": true } “require” : {“dojo/dojo” : “>1.8.0”} “require” : {“dojo/dijit” : “~1.8”} } ● require : { [Vendor Name] / [Package Name] : [version] } ● php composer.phar install
  • 6. Autoloading require ‘vendor/autoload.php’ Supported : PSR-0 AND PSR-4 { "autoload": { "psr-4": { "Monolog": "src/", "VendorNamespace": "" } } } $loader = require 'vendor/autoload.php'; $loader->add('AcmeTest', __DIR__); More Details : https://getcomposer.org/doc/04-schema.md#autoload
  • 7. Google+ API Examples { "name": "googleplus/quickstart", "description": "This quick-start ...", "license": "Apache-2.0", "repositories": [ { "type": "package", "package": { "name": "google/google-api-php-client", "version": "0.6.2", "dist": { "url": "http://google-api-php-client.googlecode.com/files/google-api-php-client-0.6.2.tar.gz", "type": "tar" }, "autoload": { "classmap": [ "src/" ] } } } ], "require": { "silex/silex": "1.0.*@dev", "twig/twig": ">=1.8,<2.0-dev", "google/google-api-php-client": "0.6.2" } }
  • 8. References http://www.phptherightway.com/#composer_and_packagist http://foohack.com/2010/08/intro-to-npm/ https://getcomposer.org/doc/00-intro.md https://security.sensiolabs.org/disclaimer http://www.php-fig.org/psr/psr-4/ https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md https://getcomposer.org/doc/04-schema.md https://developers.google.com/+/quickstart/php

×