SlideShare a Scribd company logo
Dana Luther
Packaging the Monolith
Breaking it down “one bite at a time”
@danaluther@phpc.social https://joind.in/talk/5b3d4
“We can’t upgrade because …”
Package it up!
What do we gain?
What do we gain?
•Add support for upgraded PHP Versions package by package
•Test discrete portions of the code via CI/CD pipeline
•Only use the code we actually require in each installation
•Grant access to additional personnel / contractors at the
package level
•Determine which portions of the library are obsolete and no
longer in use
Does this create new
challenges?
Does this create new
challenges?
•Additional repositories to track
•Must implement strict SEMVER
•Additional build pipelines to set up and maintain
•Expense of packagist.com or …
•Complexity of setting up and maintaining Satis
Package it up!
https://packagist.org/
But … public packages?
https://packagist.com/
Can I just host the packages
myself?
Can I just host the packages
myself?
Composer’s documentation on private packages:
https://getcomposer.org/doc/articles/handling-private-
packages-with-satis.md
Or private repositories as package sources:
https://getcomposer.org/doc/05-repositories.md#using-
private-repositories
👍
DIY - Pros and Cons
DIY - Pros and Cons
Direct Repository Links:
• Complete control over access.
• Add and maintain each link in every
project or package that depends on
this package.
• Cannot change the repository source
without updating all references.
Satis:
• Consolidates repo links into a single
source reference.
• Requires scheduled or triggered
builds to recognize new tags.
• Requires hosting the generated
source
fi
le.
“FREE”
How do we do it?
Slowly and carefully!! One component at a time.
Start with discrete components that are easily identi
fi
ed.
Where do we start?
First, map your code
First, map your code
Avoid cyclic dependencies!
Avoid cyclic dependencies!
Where do we start?
•Map out your existing library (if you don’t already have a map)
•Find the smallest building blocks - do those
fi
rst
•Prioritize the modules/components/etc.
•Don’t refactor the logic or upgrade the PHP version yet!
•Update the existing library to leverage each new package as
it’s ready (deprecate and extend).
Create the first package…
Create the first package…
•Create your new repo
•Establish namespace for your package - match your target
class namespaces.
Repo: myCoolAppCore.git
Branch: 1.x
composer.json
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Create the first package…
•Create your new repo
•Establish namespace for your package - match your target
class namespaces.
•Branch names and SemVer
•Create your new library folder structure
•Create build pipeline and test suite setup
•Import existing tests!
Create the first package…
•Import your old classes, using the new namespace structure
•Update your tests to reference the new class namespaces
•1.0.0-rc1 tag
Before:
After:
Update the original monolith.
Update the original monolith.
•Require your new package in your original library
•Update the original imported classes
•Mark as deprecated
•Update to extend from the new version (JIC!)
•Add tombstone - You just created a Zombie.
•https://slides.com/andysnell/zombie-hunt
•Update references to the old class to use the new class
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Refactoring with Rector
https://getrector.com/about
Rinse … Repeat …
Great … but now what?
New package branch/version!
New package branch/version!
•Create 2.x branch for the package repository
•Update dev-master alias to 2.x-dev
•Update minimum PHP required version to your new target
minimum version (if upgrading)
Repo: myCoolAppCore.git
Branch: 2.x
composer.json
New package branch/version!
•Create 2.x branch for the package repository
•Update dev-master alias to 2.x-dev
•Update minimum PHP required version to your new target
minimum version
•Update test suite to run properly on the new PHP version
•Don’t refactor* the tests!
•Finally … update the codebase to your target PHP version.
Tag it, rinse and repeat again…
Complete? Upgrade the core
requirements.
Questions?
Dana Luther
@danaluther@phpc.social https://joind.in/talk/5b3d4

More Related Content

PDF
Create a PHP Library the right way
PDF
composer_talk_20160209
PDF
Composer the right way [SweetlakePHP]
PDF
Composer the right way
PPTX
Nh php may 2014 - composer
PDF
Composer the Right Way - MM16NL
PDF
Dependency management with Composer
PPTX
PHP Dependency Management with Composer
Create a PHP Library the right way
composer_talk_20160209
Composer the right way [SweetlakePHP]
Composer the right way
Nh php may 2014 - composer
Composer the Right Way - MM16NL
Dependency management with Composer
PHP Dependency Management with Composer

Similar to Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time) (20)

PPT
Bridging the Gap - Laracon 2013
PDF
Leveraging Composer in Existing Projects
PDF
WordCamp Sacramento 2019: Modernizing Your Development Workflow Using Composer
PDF
Composer yourself: a reintroduction to composer
PDF
Composer the right way - NomadPHP
PDF
Composer the right way - SunshinePHP
PDF
Composer The Right Way - PHPUGMRN
PDF
Composer Best Practices
PDF
Composer Best Practices.pdf
PDF
Composer Best Practices
PDF
Composer The Right Way #PHPjhb15
PDF
Composer the right way - DPC15
PDF
Beginning with Composer - Dependency manager in php
PDF
Composer The Right Way
PPTX
Composer namespacing
PDF
Composer the Right Way - PHPBNL16
ODP
Automatic codefixes
PDF
12 Composer #burningkeyboards
PDF
Composer the Right Way - PHPSRB16
PDF
Composer The Right Way - 010PHP
Bridging the Gap - Laracon 2013
Leveraging Composer in Existing Projects
WordCamp Sacramento 2019: Modernizing Your Development Workflow Using Composer
Composer yourself: a reintroduction to composer
Composer the right way - NomadPHP
Composer the right way - SunshinePHP
Composer The Right Way - PHPUGMRN
Composer Best Practices
Composer Best Practices.pdf
Composer Best Practices
Composer The Right Way #PHPjhb15
Composer the right way - DPC15
Beginning with Composer - Dependency manager in php
Composer The Right Way
Composer namespacing
Composer the Right Way - PHPBNL16
Automatic codefixes
12 Composer #burningkeyboards
Composer the Right Way - PHPSRB16
Composer The Right Way - 010PHP
Ad

More from Dana Luther (14)

PDF
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
PDF
Enums In the Wild at PHP[tek] Conference 2025
PDF
How to analyze your codebase with Exakat using Docker - Longhorn PHP
PDF
Keep it Secret, Keep it Safe - Docker Secrets and DI
PDF
Integrated Feature Management - Using Feature Flags - PHPSerbia
PDF
Integrated Feature Management - Using Feature Flags - MidwestPHP
PDF
Integrated Feature Management - Using Feature Flags - SunshinePHP
PDF
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
PDF
Hands on Docker - Launch your own LEMP or LAMP stack
PDF
Converting Your Dev Environment to a Docker Stack - php[world]
PDF
Converting Your Dev Environment to a Docker Stack - Cascadia
PDF
Converting your DEV Environment to a Docker Stack - ZCOE18
PDF
Converting Your DEV Environment to a Docker Stack
PDF
Code Coverage for Total Security in Application Migrations
Convert Your Dev Environment to a Docker Stack - PHP Tek 2025.pdf
Enums In the Wild at PHP[tek] Conference 2025
How to analyze your codebase with Exakat using Docker - Longhorn PHP
Keep it Secret, Keep it Safe - Docker Secrets and DI
Integrated Feature Management - Using Feature Flags - PHPSerbia
Integrated Feature Management - Using Feature Flags - MidwestPHP
Integrated Feature Management - Using Feature Flags - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack
Converting Your Dev Environment to a Docker Stack - php[world]
Converting Your Dev Environment to a Docker Stack - Cascadia
Converting your DEV Environment to a Docker Stack - ZCOE18
Converting Your DEV Environment to a Docker Stack
Code Coverage for Total Security in Application Migrations
Ad

Recently uploaded (20)

PPTX
522797556-Unit-2-Temperature-measurement-1-1.pptx
PPTX
Introuction about WHO-FIC in ICD-10.pptx
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PDF
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
PPTX
Digital Literacy And Online Safety on internet
PDF
Slides PDF The World Game (s) Eco Economic Epochs.pdf
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
Introduction to Information and Communication Technology
PPT
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
PPTX
international classification of diseases ICD-10 review PPT.pptx
PDF
RPKI Status Update, presented by Makito Lay at IDNOG 10
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
Introduction to the IoT system, how the IoT system works
PPTX
Funds Management Learning Material for Beg
PPTX
E -tech empowerment technologies PowerPoint
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PPTX
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
522797556-Unit-2-Temperature-measurement-1-1.pptx
Introuction about WHO-FIC in ICD-10.pptx
WebRTC in SignalWire - troubleshooting media negotiation
Automated vs Manual WooCommerce to Shopify Migration_ Pros & Cons.pdf
Digital Literacy And Online Safety on internet
Slides PDF The World Game (s) Eco Economic Epochs.pdf
Job_Card_System_Styled_lorem_ipsum_.pptx
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Power Point - Lesson 3_2.pptx grad school presentation
Introduction to Information and Communication Technology
isotopes_sddsadsaadasdasdasdasdsa1213.ppt
international classification of diseases ICD-10 review PPT.pptx
RPKI Status Update, presented by Makito Lay at IDNOG 10
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Introduction to the IoT system, how the IoT system works
Funds Management Learning Material for Beg
E -tech empowerment technologies PowerPoint
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
CHE NAA, , b,mn,mblblblbljb jb jlb ,j , ,C PPT.pptx
An introduction to the IFRS (ISSB) Stndards.pdf

Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)