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
Managing your project PHP dependencies
Search
Théo FIDRY
October 20, 2016
Research
0
710
Managing your project PHP dependencies
Théo FIDRY
October 20, 2016
Tweet
Share
More Decks by Théo FIDRY
See All by Théo FIDRY
Mutation Testing PHPDeveloperDay
theofidry
1
620
Mutation Testing - Better code by making bugs
theofidry
3
1.2k
Mutation Testing - Better code by making bugs
theofidry
0
120
Other Decks in Research
See All in Research
文書画像のデータ化における VLM活用 / Use of VLM in document image data conversion
sansan_randd
2
410
新規のC言語処理系を実装することによる 組込みシステム研究にもたらす価値 についての考察
zacky1972
1
300
QGISハンズオン事に質問のあったProjectのGeoPackageへの保存方法についての、補足の資料です。
wata909
0
110
Elix, CBI2024, スポンサードセッション, Molecular Glue研究の展望:近年の進展とAI活用の可能性
elix
0
120
リモートワークにおけるパッシブ疲労
matsumoto_r
PRO
6
4.8k
Global Evidence Summit (GES) 参加報告
daimoriwaki
0
220
研究の進め方 ランダムネスとの付き合い方について
joisino
PRO
58
23k
Geospecific View Generation - Geometry-Context Aware High-resolution Ground View Inference from Satellite Views
satai
2
150
Composed image retrieval for remote sensing
satai
2
150
[ECCV2024読み会] 衛星画像からの地上画像生成
elith
1
990
Tiaccoon: コンテナネットワークにおいて複数トランスポート方式で統一的なアクセス制御
hiroyaonoe
0
260
論文読み会 KDD2024 | Relevance meets Diversity: A User-Centric Framework for Knowledge Exploration through Recommendations
cocomoff
0
140
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
YesSQL, Process and Tooling at Scale
rocio
170
14k
Reflections from 52 weeks, 52 projects
jeffersonlam
348
20k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
The Power of CSS Pseudo Elements
geoffreycrofte
74
5.4k
Thoughts on Productivity
jonyablonski
68
4.4k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
A better future with KSS
kneath
238
17k
Transcript
MANAGING YOUR PROJECT DEPENDENCIES GitHub: @theofidry Twitter: @tfidry 1
“There is no solution, only tradeoffs” Managing your project dependencies
- Paul M. Jones 2
Scope Managing your project dependencies • Case of study: PHP
framework agnostic library • POV: maintainer of the library • Modern PHP version (Composer) 3
What are your project dependencies? Managing your project dependencies 4
Types of dependencies Managing your project dependencies • Hard dependencies
• Optional dependencies • Dev dependencies 5
How to manage those dependencies? Managing your project dependencies 6
Managing your project dependencies Image source: https://getcomposer.org/img/logo-composer-transparent5.png
Hard dependencies Managing your project dependencies 8
Optional dependencies Managing your project dependencies 9
Optional & Dev dependencies Managing your project dependencies 10
Cool? Managing your project dependencies 11
Managing your project dependencies Image source: https://www.allmystery.de/i/tcce1a2_35567217.jpg
require-dev limitations Managing your project dependencies 13
You are changing your dependencies Managing your project dependencies 14
Managing your project dependencies symfony/yaml <3.0 15
Harder to detect issues or incompatibilities Managing your project dependencies
16
“Stupid” conflicts Managing your project dependencies static analysis tool 17
Annoying conflicts Managing your project dependencies never used together 18
Solutions? Managing your project dependencies 19
Managing your project dependencies Example #1 20
KISS: don’t use those dependencies Managing your project dependencies 21
Recap: Managing your project dependencies • pros: dead simple •
cons: you can’t use this dependency 22
Image source: http://i2.mirror.co.uk/incoming/article5940823.ece/ALTERNATES/s1227b/Luhu-the-saddest-tabby-cat.jpg
PHARs Managing your project dependencies 24
Managing your project dependencies What is a PHAR? “The phar
extension provides a way to put entire PHP applications into a single file called a "phar" (PHP Archive) “ Quote source: http://php.net/manual/en/intro.phar.php 25
26
Managing your project dependencies Image source: http://fatcdn.hipobw1hofq5ehpwigfo4.netdna-cdn.com/wp-content/uploads/2015/07/dangercat5-768x1024.jpg WARNING
The code of a PHAR is not isolated Managing your
project dependencies 28
Managing your project dependencies symfony/yaml 2.7.0 symfony/yaml 3.1.0 29
[1]: https://pixabay.com/en/atomic-bomb-mushroom-cloud-explosion-1011738/
Possible outcomes Managing your project dependencies • Everything runs fine
(lucky) • Big fat error (a bit less luck) • Very subtle nasty bug you’ll have hard time to solve (wish you luck man) 31
When can you use a PHAR? Managing your project dependencies
32
When it doesn’t execute your code Managing your project dependencies
33
Recap: Managing your project dependencies • pros: solve the conflict
problem • cons: • Inappropriate when PHARs must execute code • PHARs are not trackable 34
Managing your project dependencies Track your PHARs with tommy-muehle/tooly-composer-script 35
Managing your project dependencies 36
Managing your project dependencies Example #2 37
Use multiple repositories Managing your project dependencies 38
Managing your project dependencies • Core library : acme/lib •
Symfony bridge : acme/lib-bundle • Laravel bridge: acme/lib-laravel-provider 39
Recap: Managing your project dependencies • pros: simple • cons:
you have to manage and synchronize multiple repositories 40
Tweak testing configuration Managing your project dependencies 41
Symfony bridge tests Laravel bridge tests Core library tests 42
Recap: Managing your project dependencies • pros: it works •
cons: • can be very tricky • slow 43
Another solution? Managing your project dependencies 44
Multiple composer.json files Managing your project dependencies 45
Managing your project dependencies Example #2 46
Core library Symfony bridge Laravel bridge 47
How to easily manage them? Managing your project dependencies 48
Managing your project dependencies • bamarni/composer-bin-plugin • theofidry/composer-inheritance-plugin • wikimedia/composer-merge-plugin
49
Managing your project dependencies 50
Managing your project dependencies 51
bamarni symfony/yaml 52
Managing your project dependencies Example #2 53
Core library Laravel bridge Symfony bridge 54
55
Demo https://github.com/theofidry/sfpot-lille-managing-your-dependencies-demo Managing your project dependencies
My takeaway Managing your project dependencies
Questions? Managing your project dependencies
Thanks! Managing your project dependencies GitHub: @theofidry Twitter: @tfidry