SlideShare une entreprise Scribd logo
1  sur  56
Composer and Git
Joseph Maxwell
> cd /var/www/site/
> git pull origin master
> composer update
> npm install
> node ./node_modules/gulp/bin/gulp.js prod
> cd /var/www/site/
> git pull origin master
> composer update
> cd /var/www/site/
> git pull origin master
> composer update
[RuntimeException]
Could not delete /var/www/site/vendor/module-name/src/
Model/FileName.php. Permission denied.
> cp /var/www/dev/vendor/* /var/www/site/vendor/
>
About me
• 4x Magento 1 Certified
• Magento 2 Certified Solution
Specialist
• Built a CI system for M2
• Building Magento for 5+ years
• Twitter: @josephmaxs
Basics
Git Composer
Project files vendor/
composer.json
composer.lock
What is Version Control?
ABC-123: shopping cart now shows
warning when item out of stock.
What is Composer?
composer.json
Versioning generalist. Created on composer init.
composer.lock
Auto-generated. Pinpoint specific version numbers.
vendor/
Where all the code lives.
— Kristof Ringleff (Fooman)
“I consider placing extensions under app/code in the
same category. It instantly creates technical debt
when it comes to upgrading… By the time you
upgrade, you probably don’t even know anymore
what was written.”
https://goo.gl/yKPBgc
–Johnny Appleseed
“Type a quote here.”
https://goo.gl/j7ziK6
> composer require
Add a package.
> composer update
Creates or overwrites composer.lock with latest versions.
> composer install
Installs dependencies from composer.lock
--prefer-source
Loads git source (if possible) for package.
stall
composer install 
--no-dev 
--no-interaction 
--no-progress 
--no-suggest 
--prefer-dist 
--optimize-autoloader
--classmap-authoritative
packagist.com
Faster, supported, managed package management.
Coupon code: meet-magento-nyc17
Composer + git usage
Getting the two to work together nicely.
https://getcomposer.org/
doc/
articles/
versions.md
Tagged a new release for Composer
and it won’t show up on Packagist?
https://goo.gl/6WhieN
Major.Minor.Patch
Semantic versioning.
magento/product-community-edition:^2.2
Loads Magento 2.2 CE, updating for minor versions and
patches (ex. 2.2.1)
dev-master
Bad.
~2.2
Minimum version, allows last digit specified to increase.
2.2.*
Wildcard. Same as previous slide.
>2.2
No less than the specified version. But no cap.
In a package’s composer.json
Don’t specify version.
Merges
LOCAL = current branch and the one that will contain the merged
code.
REMOTE = the branch that you are merging into LOCAL.
KaleidoscopeApp.com
Compares files / git merge tool
Self-control
Don’t over-import packages.
Magento Project Structure
Ways to setup your project.
Symlinks: A good .gitignore:
.gitignore
app/
composer.json
composer.lock
pub/
vendor/
docs/
app/
composer.json
composer.lock
pub/
vendor/
src/
app/
composer.json
composer.lock
Tricks
Making your life easier.
Tricks
Aggregate package: package just includes others.
Tricks
https://github.com/hirak/prestissimo
Tricks
Module building: create a ~/.composer/
composer.json. Symlinks in your modules.
{
   "repositories": [
       {
           "type": "path",
           "url": “/var/www/sites/modules/your-module-name"
       }
   ],
   "minimum-stability": "dev"
}
git help
composer list
composer show
Shows the versions of the installed packages.
composer show --tree
Tree view of all installed dependencies.
Git Workflows
Everything on master
Commit #1
Commit #2
Release
GitHub Flow
Commit #1
Commit #2
Release
Pull Request
master
feature
Git Flow
Feature commits
SUPEE-10266
Pull Request
master
develop
hotfix
feature
Deployments
Getting code to production.
https://github.com/mwr/magedeploy2
PHP-only, get’s code to production.
https://github.com/davidalger/capistrano-magento2
Ruby-based, get’s code to production.
https://github.com/SwiftOtter/MagentoCI
Bash-based, built on Jenkins, complete CI for Magento 2
Summary:
Git manages your project files.
Composer manages other’s project files (dependencies).
Include composer.lock in git.
Use specific version numbers in composer.
Twitter: @josephmaxs

Contenu connexe

Tendances

Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With Gitflow
Josh Dvir
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
Mediacurrent
 
Openshift: Deployments for the rest of us
Openshift: Deployments for the rest of usOpenshift: Deployments for the rest of us
Openshift: Deployments for the rest of us
Anurag Patel
 

Tendances (20)

Git Workflow With Gitflow
Git Workflow With GitflowGit Workflow With Gitflow
Git Workflow With Gitflow
 
Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)Git in 10 minutes (WordCamp Europe 2017)
Git in 10 minutes (WordCamp Europe 2017)
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
git flow
git flowgit flow
git flow
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Moderne Android Builds mit Gradle
Moderne Android Builds mit GradleModerne Android Builds mit Gradle
Moderne Android Builds mit Gradle
 
How to deploy a Java application on Google App engine Flexible environment
How to deploy a Java application on Google App engine Flexible environmentHow to deploy a Java application on Google App engine Flexible environment
How to deploy a Java application on Google App engine Flexible environment
 
Web development, from git flow to github flow
Web development, from git flow to github flowWeb development, from git flow to github flow
Web development, from git flow to github flow
 
Google App Engine Developer - Day1
Google App Engine Developer - Day1Google App Engine Developer - Day1
Google App Engine Developer - Day1
 
Composer yourself: a reintroduction to composer
Composer yourself:  a reintroduction to composerComposer yourself:  a reintroduction to composer
Composer yourself: a reintroduction to composer
 
Openshift: Deployments for the rest of us
Openshift: Deployments for the rest of usOpenshift: Deployments for the rest of us
Openshift: Deployments for the rest of us
 
2. auto deploy to tomcat on jenkins
2. auto deploy to tomcat on jenkins2. auto deploy to tomcat on jenkins
2. auto deploy to tomcat on jenkins
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
 
Building On Puppet and Puppet Forge
Building On Puppet and Puppet ForgeBuilding On Puppet and Puppet Forge
Building On Puppet and Puppet Forge
 
Ember.js: The New Black
Ember.js: The New BlackEmber.js: The New Black
Ember.js: The New Black
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Behat sauce
Behat sauceBehat sauce
Behat sauce
 
Gulp and bower Implementation
Gulp and bower Implementation Gulp and bower Implementation
Gulp and bower Implementation
 
Git flow workflow example
Git flow workflow exampleGit flow workflow example
Git flow workflow example
 
Dockerising Appium : London Appium Meetup
Dockerising Appium : London Appium MeetupDockerising Appium : London Appium Meetup
Dockerising Appium : London Appium Meetup
 

Similaire à Composer and Git in Magento

Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
Gerrit Wanderer
 

Similaire à Composer and Git in Magento (20)

Make implementation of third party elements in magento 2 in 5-times easier
Make implementation of third party elements in magento 2 in 5-times easierMake implementation of third party elements in magento 2 in 5-times easier
Make implementation of third party elements in magento 2 in 5-times easier
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
 
3DC Intro to Git Workshop
3DC Intro to Git Workshop3DC Intro to Git Workshop
3DC Intro to Git Workshop
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Os dev tool box
Os dev tool boxOs dev tool box
Os dev tool box
 
git-docker.pdf
git-docker.pdfgit-docker.pdf
git-docker.pdf
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
GIT training - advanced for software projects
GIT training - advanced for software projectsGIT training - advanced for software projects
GIT training - advanced for software projects
 
Using Github for DSpace development
Using Github for DSpace developmentUsing Github for DSpace development
Using Github for DSpace development
 
Branching Strategies For Git and Subversion
Branching Strategies For Git and SubversionBranching Strategies For Git and Subversion
Branching Strategies For Git and Subversion
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 
Gitflow with FME and Autobuilding a Project with the Gitlab Build Pipeline
Gitflow with FME and Autobuilding a Project with the Gitlab Build PipelineGitflow with FME and Autobuilding a Project with the Gitlab Build Pipeline
Gitflow with FME and Autobuilding a Project with the Gitlab Build Pipeline
 
Git
GitGit
Git
 
GIT Basics
GIT BasicsGIT Basics
GIT Basics
 
Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
 
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
Manuele Menozzi - Gestione delle dipendenze con Composer in Magento 2
 
BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
 
Intro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio CodeIntro to JavaScript Tooling in Visual Studio Code
Intro to JavaScript Tooling in Visual Studio Code
 
Git development workflow
Git development workflowGit development workflow
Git development workflow
 
Magento 2 + composer
Magento 2 + composerMagento 2 + composer
Magento 2 + composer
 

Plus de SWIFTotter Solutions

Plus de SWIFTotter Solutions (7)

Developing a Web-Based business
Developing a Web-Based businessDeveloping a Web-Based business
Developing a Web-Based business
 
Magento SEO Tips and Tricks
Magento SEO Tips and TricksMagento SEO Tips and Tricks
Magento SEO Tips and Tricks
 
eCommerce Primer - Part 1
eCommerce Primer - Part 1eCommerce Primer - Part 1
eCommerce Primer - Part 1
 
A brief introduction to CloudFormation
A brief introduction to CloudFormationA brief introduction to CloudFormation
A brief introduction to CloudFormation
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
 
Demystifying OAuth2 for PHP
Demystifying OAuth2 for PHPDemystifying OAuth2 for PHP
Demystifying OAuth2 for PHP
 
PHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better CodePHP: 4 Design Patterns to Make Better Code
PHP: 4 Design Patterns to Make Better Code
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Composer and Git in Magento