Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Composer: Modern PHP Package Management
Search
Justin Yost
April 08, 2016
Programming
0
69
Composer: Modern PHP Package Management
Justin Yost
April 08, 2016
Tweet
Share
More Decks by Justin Yost
See All by Justin Yost
Laravel 6, 7 and Other Goodies
justinyost
2
94
PHP and Databases
justinyost
2
58
Ansible: What Is It and What Is It Good For?
justinyost
0
60
Generators: All About the Yield
justinyost
0
11
Laravel 6: What's New and What's Changed
justinyost
0
220
Middleware: Between the Framework and the Browser
justinyost
2
100
Caching and You and You and You and You...
justinyost
0
81
Git: The Pain and the Gain
justinyost
0
180
Generators: All About the Yield
justinyost
0
280
Other Decks in Programming
See All in Programming
モダンOBSプラグイン開発
umireon
0
170
『Kubernetes ☸️ で実践する Platform Engineering 』を最高速度で読み抜いたる!!👊🏻
hiroki_hasegawa
0
100
API Platformを活用したPHPによる本格的なWeb API開発 / api-platform-book-intro
ttskch
1
150
Rethinking API Platform Filters
vinceamstoutz
0
140
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
360
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
Laravel Nightwatchの裏側 - Laravel公式Observabilityツールを支える設計と実装
avosalmon
1
140
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.4k
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
190
存在論的プログラミング: 時間と存在を記述する
koriym
3
350
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
130
AI駆動開発の本音 〜Claude Code並列開発で見えたエンジニアの新しい役割〜
hisuzuya
4
530
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.2k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
A better future with KSS
kneath
240
18k
Technical Leadership for Architectural Decision Making
baasie
3
300
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
320
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
120
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Paper Plane
katiecoart
PRO
0
48k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
400
So, you think you're a good person
axbom
PRO
2
2k
Test your architecture with Archunit
thirion
1
2.2k
Transcript
Composer: Modern PHP Package Management Justin Yost Web Developer at
Loadsys
What is Composer? —Composer is a modern PHP Dependency Management
Tool
What is Dependency Management? —Install Stuff —Everyone else installs same
version of stuff
Why Do I Care? —Multiple teammates —Install multiple versions on
your machine —Easily stay up to date —Build new projects with Awesome Framework
Requirements —PHP 5.3.2+
Install Mac: php composer-setup.php --install-dir=bin --filename=composer mv composer.phar /usr/local/bin/composer Windows:
look in the docs
What Now? —Now, we can install packages pretty easily
Example
composer require rych/random
require __DIR__ . '/vendor/autoload.php'; $random = new Rych\Random\Random(); $randomInt =
$random->getRandomInteger(1, 100); echo $randomInt . "\r\n";
Where should you use Composer —Everywhere you have a dependency
as part of your PHP projects —Everywhere you have a shared PHP project
What all can Composer do? —It doesn't have to be
PHP —Loadsys has a suite of shell scripts managed via Composer —github.com/loadsys/CakePHP-Shell-Scripts
What all can Composer do? —It doesn't have to be
public facing —Composer will hook into private repositories
What all can Composer do? —The project doesn't even have
to use Composer itself —Composer will install Git/SVN/Mercurial/PEAR backed projects by itself
What all can Composer do? —Install Dependencies for Dev Only
—composer require --dev {vendor/package} —composer install --dev/--no-dev
What all can Composer do? —PHP Version/Extension Requirements "require": {
"php": ">=5.6.0", "ext-openssl": "*" }
What all can Composer do? —SubDependencies —Example chain: symfony/symfony ->
doctrine/common -> doctrine/inflector -> php >=5.3.2
What all can Composer do? —SubDependencies in DevMode —Only installs
top level dev dependencies —Example chain: symfony/symfony -> cache/integration- tests -> psr/cache -> php: >=5.3.0
What all can Composer do? —Lock to Major/Minor/Patch Releases vendor/package:
3.* vendor/package: 3.0.* vendor/package: ~1.2 vendor/package: ~1.2.3 vendor/package: ^1.2.3 vendor/package: ^0.3
What all can Composer do? —Suggest other packages "suggest": {
"vendor/package": "Allow you to do other awesome thing.", },
What all can Composer do? —List Meta Information for Package
"homepage", "license", "authors", "support", "keywords", "description",
What all can Composer do? —Replace other packages "replace": {
"vendor/package": "self.version" }
What all can Composer do? —Conflicts "conflict": { "vendor/package": "1.2.3"
}
What all can Composer do? —Install SubTypes "type": "library", "type":
"project", "type": "metapackage",
What all can Composer do? —Install Custom Types —https://github.com/composer/installers "type":
"wordpress-plugin", "require": { "composer/installers": "~1.0" }
What all can Composer do? —Install Specific Branches "require": {
"vendor/package": "dev-bugfixes" }
Example
Composer Create Project composer create-project —create-project is pretty unique to
Composer —Clones a package, installs dependencies and run scripts for setup, etc
Example
Packagist —Packagist is a repository of Composer Packages for the
PHP Community —Packagist is open source and you can add your own packages
Publish your own stuff on Packagist —Code
ToranProxy —Internal version of Packagist —Provides dupes of public packages
—Provides hosting for internal only packages
Upgrade Your Development Process —Composer will make your projects easier
to manage —Composer will make dependencies less of a hassle —Composer will make deployments simpler and easier
Composer Workflow —composer require —composer install —composer update —composer remove
Final Thoughts —Composer is PHP's way of handling dependency management
—Composer is pretty easy to get started with —Publish your stuff with Composer/Packagist
Thanks/Questions? —twitter.com/justinyost —github.com/justinyost —justinyost.com —lynda.com/justinyost