SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
Dependency Management
Composer
What is a Dependency Manager?
Suppose:
You have a project that depends on a number of libraries.
Some of those libraries depend on other libraries.
Dependency Manager:
Enables you to declare the libraries you depend on.
Finds out which versions of which packages can and need to be installed, and installs them
(meaning it downloads them into your project).
Allows you to share specific package versions across environments and teams.
Meet Composer
getcomposer.org
getComposer.org
Installation
Either Per Project (recommended) or Globally
Install the version of composer that matches your development environment
DO NOT commit installed packages to Version Control
Finding and Using Packages
Define Your Dependencies
{
"require": {
"vendor/package": "1.3.2",
"vendor/package2": "1.*",
"vendor/package3": "^2.0.3"
}
}
Custom Path
{

"extra": {

"installer-paths": {

"sites/example.com/modules/{$name}": ["vendor/package"]

}

}

}
Maintaining Versions
Semantic Versioning https://semver.org/
Major.Minor.Patch
Exact
You can specify the exact version of a package. This will tell Composer to
install this version and this version only. If other dependencies require a
different version, the solver will ultimately fail and abort any install or update
procedures. 
Example: 1.0.2
Range
By using comparison operators you can specify ranges of valid versions. Valid operators are >, >=, <, <=, !=.
You can define multiple ranges. Ranges separated by a space ( ) or comma (,) will be treated as a logical
AND. A double pipe (||) will be treated as a logical OR. AND has higher precedence than OR.
Note: Be careful when using unbounded ranges as you might end up unexpectedly installing versions that
break backwards compatibility. Consider using the caret operator instead for safety. 
Examples:
>=1.0
>=1.0 <2.0
>=1.0 <1.1 || >=1.2*
Next Significant Release: Tilde
The ~ operator is best explained by example: ~1.2 is equivalent to >=1.2
<2.0.0, while ~1.2.3 is equivalent to >=1.2.3 <1.3.0. As you can see it is
mostly useful for projects respecting semantic versioning. A common usage
would be to mark the minimum minor version you depend on, like ~1.2
(which allows anything up to, but not including, 2.0). Since in theory there
should be no backwards compatibility breaks until 2.0, that works well.
Another way of looking at it is that using ~ specifies a minimum version, but
allows the last digit specified to go up. 
Example: ~1.2
Next Significant Release: Caret
The ^ operator behaves very similarly but it sticks closer to semantic
versioning, and will always allow non-breaking updates. For example ^1.2.3
is equivalent to >=1.2.3 <2.0.0 as none of the releases until 2.0 should
break backwards compatibility. For pre-1.0 versions it also acts with safety
in mind and treats ^0.3 as >=0.3.0 <0.4.0.
This is the recommended operator for maximum interoperability when
writing library code. 
Example: ^1.2.3
Testing Version Constraints
There is a handy packagist semver checker (short for symantic versioning)
that allows you to test out your version constraints.
https://semver.mwl.be/
Define Your Dependencies
{
"require": {
"vendor/package": "1.3.2",
"vendor/package2": "1.*",
"vendor/package3": "^2.0.3"
}
}
Consistent Environments
composer.lock
{

"_readme": [

"This file locks the dependencies of your project to a known state",

"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",

"This file is @generated automatically"

],

"content-hash": xxxxx,

"packages": [

{

"dist": {

"type": "zip",

"url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",

"reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",

"shasum": ""

},

"require": {

"psr/container": "^1.0"
},

"type": "library",

"autoload": {

"psr-4": {

"InteropContainer": "src/Interop/Container/"

}

},

"notification-url": "https://packagist.org/downloads/",

"license": [

"MIT"

],

"description": "Promoting the interoperability of container objects (DIC, SL, etc.)",

"homepage": "https://github.com/container-interop/container-interop",

"time": "2017-02-14T19:40:03+00:00"

}…
Autoloading
PSR-4, PSR-0, classmap and files
PSR-4
"autoload": {

"psr-4": {

“App": "src/",

"VendorNamespace": ""

}

}

// same prefix in multiple directories

"autoload": {

"psr-4": { "App": ["src/", "lib/"] }

}

// fallback directory

"autoload": {

"psr-4": { "": "src/" }

}
PSR-0
"autoload": {

"psr-0": {

“App": "src/",

"VendorNamespace": "src/",

"Vendor_Namespace_": "src/"

}

}

// same prefix in multiple directories

"autoload": {

"psr-0": { "App": ["src/", "lib/"] }

}

// fallback directory

"autoload": {

“psr-0": { "": "src/" }

}
Classmap
{

"autoload": {

"classmap": ["src/", "lib/", “src/Something.php"]

}

}
Files
"autoload": {

"files": [“src/MyLibrary/functions.php”, “src/myfile.php”]

}
Creating your own Package
Every project is a package
Your Library Structure
hello-world
src
hello-world
Greeting.php
composer.json
composer.lock
Greeting.php
<?php
namespace hello-world;
class Greeting {
…
}
Your Library: composer.json
{
"name": “acme/hello-world”,
"require": {
"monolog/monolog": “1.0.*"
}
}
Your Project: composer.json
{

"name": "acme/blog",
"repositories": [

{

"type": "vcs",

"url": "https://github.com/sketchings/hello-world"

}

],
"require": {

"acme/hello-world": ^0.1

}

}
Alena Holligan
• Wife, and Mother of 3 young children
• PHP Teacher at Treehouse
• Portland PHP User Group Leader
• Cascadia PHP Conference (cascadiaphp.com)
@alenaholligan alena@holligan.us https://joind.in/talk/3064d

Más contenido relacionado

La actualidad más candente

Metasploit with postgresql_on_kali_linux_1.0.6
Metasploit with postgresql_on_kali_linux_1.0.6Metasploit with postgresql_on_kali_linux_1.0.6
Metasploit with postgresql_on_kali_linux_1.0.6Tinydile
 
Excuse me, your Crypto is showing!
Excuse me, your Crypto is showing!Excuse me, your Crypto is showing!
Excuse me, your Crypto is showing!Siddharth Mathur
 
AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...
AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...
AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...Cohesive Networks
 
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...Codemotion
 
Containerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to KubernetesContainerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to KubernetesAshley Roach
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Securityinovex GmbH
 
GCC 2014 scriptable workshop
GCC 2014 scriptable workshopGCC 2014 scriptable workshop
GCC 2014 scriptable workshopEnis Afgan
 
Webinar patterns anti patterns
Webinar patterns anti patternsWebinar patterns anti patterns
Webinar patterns anti patternsconfluent
 
Container Monitoring with Sysdig
Container Monitoring with SysdigContainer Monitoring with Sysdig
Container Monitoring with SysdigSreenivas Makam
 
VerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerVerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerAdriano Pimpini
 
Kubernetes and bluemix
Kubernetes  and  bluemixKubernetes  and  bluemix
Kubernetes and bluemixDuckDuckGo
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Docker, Inc.
 
Introduction to k3s and k3sup
Introduction to k3s and k3supIntroduction to k3s and k3sup
Introduction to k3s and k3supSaiyam Pathak
 
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
Reaching 5 Million Messaging Connections:  Our Journey with KubernetesReaching 5 Million Messaging Connections:  Our Journey with Kubernetes
Reaching 5 Million Messaging Connections: Our Journey with KubernetesConnected
 

La actualidad más candente (20)

Metasploit with postgresql_on_kali_linux_1.0.6
Metasploit with postgresql_on_kali_linux_1.0.6Metasploit with postgresql_on_kali_linux_1.0.6
Metasploit with postgresql_on_kali_linux_1.0.6
 
Excuse me, your Crypto is showing!
Excuse me, your Crypto is showing!Excuse me, your Crypto is showing!
Excuse me, your Crypto is showing!
 
AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...
AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...
AppSec USA 2014 talk by Chris Swan "Implications & Opportunities at the Bleed...
 
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
Jacopo Nardiello - Monitoring Cloud-Native applications with Prometheus - Cod...
 
Containerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to KubernetesContainerizing a REST API and Deploying to Kubernetes
Containerizing a REST API and Deploying to Kubernetes
 
London Hug 20/6 - Vault production
London Hug 20/6 - Vault productionLondon Hug 20/6 - Vault production
London Hug 20/6 - Vault production
 
Kubernetes Security
Kubernetes SecurityKubernetes Security
Kubernetes Security
 
GCC 2014 scriptable workshop
GCC 2014 scriptable workshopGCC 2014 scriptable workshop
GCC 2014 scriptable workshop
 
Webinar patterns anti patterns
Webinar patterns anti patternsWebinar patterns anti patterns
Webinar patterns anti patterns
 
Kubernetes networking & Security
Kubernetes networking & SecurityKubernetes networking & Security
Kubernetes networking & Security
 
Managing system remotely
Managing system remotely Managing system remotely
Managing system remotely
 
Container Monitoring with Sysdig
Container Monitoring with SysdigContainer Monitoring with Sysdig
Container Monitoring with Sysdig
 
Minecraft Docker
Minecraft DockerMinecraft Docker
Minecraft Docker
 
Kubernetes security
Kubernetes securityKubernetes security
Kubernetes security
 
VerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT BrokerVerneMQ - Distributed MQTT Broker
VerneMQ - Distributed MQTT Broker
 
Kubernetes and bluemix
Kubernetes  and  bluemixKubernetes  and  bluemix
Kubernetes and bluemix
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
 
Subversion
SubversionSubversion
Subversion
 
Introduction to k3s and k3sup
Introduction to k3s and k3supIntroduction to k3s and k3sup
Introduction to k3s and k3sup
 
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
Reaching 5 Million Messaging Connections:  Our Journey with KubernetesReaching 5 Million Messaging Connections:  Our Journey with Kubernetes
Reaching 5 Million Messaging Connections: Our Journey with Kubernetes
 

Similar a Dependency Management

SVN Usage & Best Practices
SVN Usage & Best PracticesSVN Usage & Best Practices
SVN Usage & Best PracticesAshraf Fouad
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with ComposerAdam Englander
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
Managing Change
Managing ChangeManaging Change
Managing ChangeMirko Jahn
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guidevjvarenya
 
Developing Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaDeveloping Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaJoe Stein
 
Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsExpeed Software
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld PresentationDan Hinojosa
 
Piattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgentiPiattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgentiGiulio Destri
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best PracticesAbid Malik
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best PracticesAbid Malik
 
Composer Best Practices.pdf
Composer Best Practices.pdfComposer Best Practices.pdf
Composer Best Practices.pdfAbid Malik
 
Development and deployment with composer and kite
Development and deployment with composer and kiteDevelopment and deployment with composer and kite
Development and deployment with composer and kiteChristian Opitz
 
Melbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpecMelbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpecMatt Ray
 
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise IntegratorTroubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise IntegratorWSO2
 
Create a PHP Library the right way
Create a PHP Library the right wayCreate a PHP Library the right way
Create a PHP Library the right wayChristian Varela
 

Similar a Dependency Management (20)

SVN Usage & Best Practices
SVN Usage & Best PracticesSVN Usage & Best Practices
SVN Usage & Best Practices
 
PHP Dependency Management with Composer
PHP Dependency Management with ComposerPHP Dependency Management with Composer
PHP Dependency Management with Composer
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Composer
ComposerComposer
Composer
 
Build server
Build serverBuild server
Build server
 
Readme
ReadmeReadme
Readme
 
Managing Change
Managing ChangeManaging Change
Managing Change
 
Prizm Installation Guide
Prizm Installation GuidePrizm Installation Guide
Prizm Installation Guide
 
Developing Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache KafkaDeveloping Realtime Data Pipelines With Apache Kafka
Developing Realtime Data Pipelines With Apache Kafka
 
Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applications
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld Presentation
 
Piattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgentiPiattaforma Web Linux completa dai sorgenti
Piattaforma Web Linux completa dai sorgenti
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
 
Composer Best Practices
Composer Best PracticesComposer Best Practices
Composer Best Practices
 
Composer Best Practices.pdf
Composer Best Practices.pdfComposer Best Practices.pdf
Composer Best Practices.pdf
 
Development and deployment with composer and kite
Development and deployment with composer and kiteDevelopment and deployment with composer and kite
Development and deployment with composer and kite
 
Composer namespacing
Composer namespacingComposer namespacing
Composer namespacing
 
Melbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpecMelbourne Infracoders: Compliance as Code with InSpec
Melbourne Infracoders: Compliance as Code with InSpec
 
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise IntegratorTroubleshooting and Best Practices with WSO2 Enterprise Integrator
Troubleshooting and Best Practices with WSO2 Enterprise Integrator
 
Create a PHP Library the right way
Create a PHP Library the right wayCreate a PHP Library the right way
Create a PHP Library the right way
 

Más de Alena Holligan

2023 Longhorn PHP - Learn to Succeed .pdf
2023 Longhorn PHP - Learn to Succeed .pdf2023 Longhorn PHP - Learn to Succeed .pdf
2023 Longhorn PHP - Learn to Succeed .pdfAlena Holligan
 
Environmental variables
Environmental variablesEnvironmental variables
Environmental variablesAlena Holligan
 
Experiential Project Design
Experiential Project DesignExperiential Project Design
Experiential Project DesignAlena Holligan
 
Organization Patterns: MVC
Organization Patterns: MVCOrganization Patterns: MVC
Organization Patterns: MVCAlena Holligan
 
When & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsWhen & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsAlena Holligan
 
Obect-Oriented Collaboration
Obect-Oriented CollaborationObect-Oriented Collaboration
Obect-Oriented CollaborationAlena Holligan
 
WordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPressWordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPressAlena Holligan
 
Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18Alena Holligan
 
Exploiting the Brain for Fun and Profit
Exploiting the Brain for Fun and ProfitExploiting the Brain for Fun and Profit
Exploiting the Brain for Fun and ProfitAlena Holligan
 
Environmental Variables
Environmental VariablesEnvironmental Variables
Environmental VariablesAlena Holligan
 
Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017Alena Holligan
 
Demystifying Object-Oriented Programming - PHP UK Conference 2017
Demystifying Object-Oriented Programming - PHP UK Conference 2017Demystifying Object-Oriented Programming - PHP UK Conference 2017
Demystifying Object-Oriented Programming - PHP UK Conference 2017Alena Holligan
 
Exploiting the Brain for Fun & Profit #zendcon2016
Exploiting the Brain for Fun & Profit #zendcon2016Exploiting the Brain for Fun & Profit #zendcon2016
Exploiting the Brain for Fun & Profit #zendcon2016Alena Holligan
 

Más de Alena Holligan (20)

2023 Longhorn PHP - Learn to Succeed .pdf
2023 Longhorn PHP - Learn to Succeed .pdf2023 Longhorn PHP - Learn to Succeed .pdf
2023 Longhorn PHP - Learn to Succeed .pdf
 
Environmental variables
Environmental variablesEnvironmental variables
Environmental variables
 
Dev parent
Dev parentDev parent
Dev parent
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Experiential Project Design
Experiential Project DesignExperiential Project Design
Experiential Project Design
 
Reduce Reuse Refactor
Reduce Reuse RefactorReduce Reuse Refactor
Reduce Reuse Refactor
 
Organization Patterns: MVC
Organization Patterns: MVCOrganization Patterns: MVC
Organization Patterns: MVC
 
When & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traitsWhen & Why: Interfaces, abstract classes, traits
When & Why: Interfaces, abstract classes, traits
 
Object Features
Object FeaturesObject Features
Object Features
 
Obect-Oriented Collaboration
Obect-Oriented CollaborationObect-Oriented Collaboration
Obect-Oriented Collaboration
 
WordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPressWordCamp Portland 2018: PHP for WordPress
WordCamp Portland 2018: PHP for WordPress
 
Let's Talk Scope
Let's Talk ScopeLet's Talk Scope
Let's Talk Scope
 
Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18
 
Exploiting the Brain for Fun and Profit
Exploiting the Brain for Fun and ProfitExploiting the Brain for Fun and Profit
Exploiting the Brain for Fun and Profit
 
Environmental Variables
Environmental VariablesEnvironmental Variables
Environmental Variables
 
Learn to succeed
Learn to succeedLearn to succeed
Learn to succeed
 
Demystifying oop
Demystifying oopDemystifying oop
Demystifying oop
 
Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017Demystifying Object-Oriented Programming - PHP[tek] 2017
Demystifying Object-Oriented Programming - PHP[tek] 2017
 
Demystifying Object-Oriented Programming - PHP UK Conference 2017
Demystifying Object-Oriented Programming - PHP UK Conference 2017Demystifying Object-Oriented Programming - PHP UK Conference 2017
Demystifying Object-Oriented Programming - PHP UK Conference 2017
 
Exploiting the Brain for Fun & Profit #zendcon2016
Exploiting the Brain for Fun & Profit #zendcon2016Exploiting the Brain for Fun & Profit #zendcon2016
Exploiting the Brain for Fun & Profit #zendcon2016
 

Último

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 

Último (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

Dependency Management

  • 2. What is a Dependency Manager? Suppose: You have a project that depends on a number of libraries. Some of those libraries depend on other libraries. Dependency Manager: Enables you to declare the libraries you depend on. Finds out which versions of which packages can and need to be installed, and installs them (meaning it downloads them into your project). Allows you to share specific package versions across environments and teams.
  • 5. Installation Either Per Project (recommended) or Globally Install the version of composer that matches your development environment DO NOT commit installed packages to Version Control
  • 6. Finding and Using Packages
  • 7.
  • 8. Define Your Dependencies { "require": { "vendor/package": "1.3.2", "vendor/package2": "1.*", "vendor/package3": "^2.0.3" } }
  • 9. Custom Path {
 "extra": {
 "installer-paths": {
 "sites/example.com/modules/{$name}": ["vendor/package"]
 }
 }
 }
  • 12. Exact You can specify the exact version of a package. This will tell Composer to install this version and this version only. If other dependencies require a different version, the solver will ultimately fail and abort any install or update procedures.  Example: 1.0.2
  • 13. Range By using comparison operators you can specify ranges of valid versions. Valid operators are >, >=, <, <=, !=. You can define multiple ranges. Ranges separated by a space ( ) or comma (,) will be treated as a logical AND. A double pipe (||) will be treated as a logical OR. AND has higher precedence than OR. Note: Be careful when using unbounded ranges as you might end up unexpectedly installing versions that break backwards compatibility. Consider using the caret operator instead for safety.  Examples: >=1.0 >=1.0 <2.0 >=1.0 <1.1 || >=1.2*
  • 14. Next Significant Release: Tilde The ~ operator is best explained by example: ~1.2 is equivalent to >=1.2 <2.0.0, while ~1.2.3 is equivalent to >=1.2.3 <1.3.0. As you can see it is mostly useful for projects respecting semantic versioning. A common usage would be to mark the minimum minor version you depend on, like ~1.2 (which allows anything up to, but not including, 2.0). Since in theory there should be no backwards compatibility breaks until 2.0, that works well. Another way of looking at it is that using ~ specifies a minimum version, but allows the last digit specified to go up.  Example: ~1.2
  • 15. Next Significant Release: Caret The ^ operator behaves very similarly but it sticks closer to semantic versioning, and will always allow non-breaking updates. For example ^1.2.3 is equivalent to >=1.2.3 <2.0.0 as none of the releases until 2.0 should break backwards compatibility. For pre-1.0 versions it also acts with safety in mind and treats ^0.3 as >=0.3.0 <0.4.0. This is the recommended operator for maximum interoperability when writing library code.  Example: ^1.2.3
  • 16. Testing Version Constraints There is a handy packagist semver checker (short for symantic versioning) that allows you to test out your version constraints. https://semver.mwl.be/
  • 17. Define Your Dependencies { "require": { "vendor/package": "1.3.2", "vendor/package2": "1.*", "vendor/package3": "^2.0.3" } }
  • 19. {
 "_readme": [
 "This file locks the dependencies of your project to a known state",
 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
 "This file is @generated automatically"
 ],
 "content-hash": xxxxx,
 "packages": [
 {
 "dist": {
 "type": "zip",
 "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",
 "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",
 "shasum": ""
 },
 "require": {
 "psr/container": "^1.0" },
 "type": "library",
 "autoload": {
 "psr-4": {
 "InteropContainer": "src/Interop/Container/"
 }
 },
 "notification-url": "https://packagist.org/downloads/",
 "license": [
 "MIT"
 ],
 "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
 "homepage": "https://github.com/container-interop/container-interop",
 "time": "2017-02-14T19:40:03+00:00"
 }…
  • 21. PSR-4 "autoload": {
 "psr-4": {
 “App": "src/",
 "VendorNamespace": ""
 }
 }
 // same prefix in multiple directories
 "autoload": {
 "psr-4": { "App": ["src/", "lib/"] }
 }
 // fallback directory
 "autoload": {
 "psr-4": { "": "src/" }
 }
  • 22. PSR-0 "autoload": {
 "psr-0": {
 “App": "src/",
 "VendorNamespace": "src/",
 "Vendor_Namespace_": "src/"
 }
 }
 // same prefix in multiple directories
 "autoload": {
 "psr-0": { "App": ["src/", "lib/"] }
 }
 // fallback directory
 "autoload": {
 “psr-0": { "": "src/" }
 }
  • 23. Classmap {
 "autoload": {
 "classmap": ["src/", "lib/", “src/Something.php"]
 }
 }
  • 25. Creating your own Package Every project is a package
  • 28. Your Library: composer.json { "name": “acme/hello-world”, "require": { "monolog/monolog": “1.0.*" } }
  • 29. Your Project: composer.json {
 "name": "acme/blog", "repositories": [
 {
 "type": "vcs",
 "url": "https://github.com/sketchings/hello-world"
 }
 ], "require": {
 "acme/hello-world": ^0.1
 }
 }
  • 30. Alena Holligan • Wife, and Mother of 3 young children • PHP Teacher at Treehouse • Portland PHP User Group Leader • Cascadia PHP Conference (cascadiaphp.com) @alenaholligan alena@holligan.us https://joind.in/talk/3064d