Loading presentation...

Present Remotely

Send the link below via email or IM

Copy

Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.

DeleteCancel

Make your likes visible on Facebook?

Connect your Facebook account to Prezi and let your likes appear on your timeline.
You can change this under Settings & Account at any time.

No, thanks

Dependency Manager for PHP

No description
by

Marko Antolovic

on 9 April 2014

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Dependency Manager for PHP

Because php sucks at sharing
how do I get 3rd party library?
how do I load its code?
does it depend on anything?
where do i put the files?
How to install
$ curl -sS https://getcomposer.org/installer | php
Benefits
easily declare project dependencies
updating dependency versions extremely simple
ensures your team is on the same page
How to update composer
$ php composer.phar self-update
download and run Composer-Setup.exe
Defining Dependencies
{
"require": {
"monolog/monolog": "1.6.*"
}
}
place composer.json in the root of your project
specify the required library
specify version
$ php composer.phar install
or globaly
$ composer install
Versions
exact version 1.0.0, 3.1.9, etc
wildcard 5.*, 6.2.*
range >, >=, !=

example: >=3.5
range: >=1.0,<1.7
next significant release ~ 1.3.3 same as (>=1.3.3,<1.4)

composer.lock
install writes a dependency lock file
list of exact version installed
composer install first checks the lock file
commit both composer.lock and composer.json
Running composer install
Preparing for production
composer install --no-dev --prefer-dist
composer dump-autoload --optimize
Convert PSR-0/4 autoloading to classmap to get a faster autoloader. This is recommended especially for production, but can take a bit of time to run so it is currently not done by default.
Skip installing packages listed in require-dev
Install packages as archive if available
autoload_classmap.php
QUESTIONS ?
Dependency Manager for PHP
How to use composer in your project
add require_once 'vendor/autoload.php'
Your very own library
package requreiments
autoloading
name
aditional metadata
{

"name": "jeremykendall/php-domain-parser",
"description": "Public Suffix List based URL parsing implemented in PHP.",
"license": "MIT",
"authors": [
{
"name": "Jeremy Kendall",
"homepage": "http://about.me/jeremykendall",
"role": "Developer"
}
],
"bin": [
"bin/parser",
"bin/pdp-psl"
],
"keywords": [
"Public Suffix List",
"domain parsing",
"url parsing"
],

"require": {
"php": ">=5.3.0",
"ext-curl": "*"
},
"require-dev": {
"mikey179/vfsStream": "1.1.*",
"phpunit/phpunit": "3.7.*"
},
"autoload": {
"psr-0": {
"Pdp\\": "library/"
}
},
"scripts": {
"post-install-cml": [
"PhpCtagger\\Composer\\Script\\Ctager::ctag"
]
}

}
development requirements
bin - cli scripts
script execution hook
Using libraries from your repository
{

"name": "Pixi/SDK",

"repositories": [
{
"type": "vcs",
"url": "https://bitbucket.org/pixi_software/pixi-sdk-assets"
},
{
"type": "vcs",
"url": "https://bitbucket.org/pixi_software/pixi-sdk-ui"
},
{
"type": "vcs",
"url": "https://bitbucket.org/pixi_software/pixi-sdk-soap"
},
{
"type": "vcs",
"url": "https://bitbucket.org/pixi_software/pixi-sdk-factory"
}
],

"require": {
"php": " >= 5.3.2",

"components/pixi": "default",
"pixi/ui": "default",
"pixi/api": "default",
"pixi/factory": "default"
},

"config": {
"component-dir": "./assets"
},

"autoload": {
"classmap": ["application/controllers/"]
},

"minimum-stability": "dev"

}
path to the repository
Marko Antolovic
Full transcript