Presentación
HTML (pincha para descargar)
Vídeo
Transcripción
Extracto de la transcripción automática del vídeo realizada por YouTube.
thing everyone awake a little bit getting there all right let me move my speaker notes over and i'll be ready to start so today I am going to talk to all about dependency management in PHP and better late than never of course because it's existed for
a long time and many other programming languages and it's but but now PHP is has arrived at the party to give you a brief overview of what we're going to go over in our talk we're going to talk about what dependency management is and how it can
help you how to discover and use packages and how to write and publish your own packages time allowing we're also going to look at what came before in particular pair and look at how using composer for dependency management can help you with continuous
integration so to tell you a little bit about me my name is Sequoia McDowell I am in software engineer at ptc it's a 3d modeling company but I work on web stuff PHP is my first language I did the typical trajectory of you know write your own CMS from scratch
I used pair joomla wordpress cakephp slim more recently and I mention it only to say I've I've lived this I've lived the history of project organization in PHP and although i mostly use Java and JavaScript now I got to use PHP on a project at work
recently used composer and was really surprised and excited to see the way projects are being organized in PHP now it's really refreshing and let's make me want to take a second look at PHP I say better late than never on this this talk because as
you know a lot of communities have been doing this for a while if you've you Ruby you maybe use Ruby gems or fuse knowed you'd use NPM and the last thing I want to say is that again I'm giving this talk about composer not because I'm the world's
leading expert in composer but because I see this as being the future of where PHP development is going and I think it's a really exciting topic and something that we all should learn more about and of course after the talk feel free to come and say hi
to me so package management what is a package manager I went ahead and pull the quote off of Wikipedia but basically a package manager is a tool that helps you install software you probably use one before if you use linux to use d package or apt aptitude apps
get if you use red hat there's RPM and young npm for node and Ruby gems for Ruby so most of you probably use a package management tool tool at some point and the next question is what is a package if a package manager is a tool to install it then what
is a package and packages differ depending on what you're trying to install obvious silly if you're installing a Debian packages dot Deb installing a package on redhat it's it's RPM but for the purposes of composed in PHP and this is straight
from the composer documentation a package is essentially just a directory containing something so a package in PHP is very an example as an example of this and I apologize for the contrast here but as an example of this I grabbed a package zelin and curl you
can see anybody who's familiar with PHP namespacing rps are 0 i'm not going to go into that in this talk but i'll just say that you can see that Zelan and the namespace curls a library you take a look in this package and you can see there's
a composer JSON the example in the readme are kind of extra the main thing is a composer JSON and the source directory which contains a directory with the namespace and the file name which is the same as a class name and so I picked this because it's a
very simple example and also to show that packages aren't big and scary per se they can be very simple some of you may have noticed that I'm kind of switching back and forth between the terms package manager and dependency manager and there is a bit
of it there is a difference between the two which I'll touch on briefly here a package manager installs packages globally that are two or can install packages globally that are to be invoked globally so for example if you've ever worked with grunt
in the JavaScript world you do NPM installed SG grunt you install it globally then you can evoke run from anywhere so basically you're installing a tool on your system a dependency manager installs packages locally relative to a project for the project
and so with composer there is no composer install package name there is no global composer install with composer you only ever install things relative to your project and that's why they make the that's why they make the distinction of referring to
it as a dependency manager and not a package manager it will never install anything globally so why do you want to use a dependency manager there are several reasons it allows for easier installation of an application you can just clone the project and run
a single command sometimes you just run a single command it reads your configuration files and we'll set up the project for you there are fewer version conflicts when using the dependency manager if you have multiple project on multiple projects on the
same box maybe you are sharing some libraries one of your projects gets upgraded and now you have a version conflict with the dependency manager you keep all this in configuration files every project can have its own versions of its own disease you can find
problems faster especially for platform dependencies as well as requiring we'll go over this some more in a minute but as well as requiring requiring a library saying I require the monologue logging library you can also declare platform dependencies in
with composer which is to say you can say I need PHP 5.3 I need the person to have curl installed etc this is useful because if for example you are your site archives data using bzip and then you know deletes the data and sets the archives aside when you go
to look for your archives and you discover the bzip is not installed and you check your error logs and there's no archives there and it just keeps complaining that doesn't have be zip that's the sort of old way of finding that you don't have
one of the things you need for that application if you have composure when you try it if you were when you require something you will find out right when you install that you don't have the thing so it can save you a lot of headaches it allows some more
consistency and transparency if you're looking at a project that uses composer you know that you can open up the composer JSON file see what dependencies that has see what it relies on and see the author where to get support etc and find out a little bit
about the project and which is nice in contrast to getting a new project and having to look all over and try to figure out what's going on and the last point is just dollar signs as well as the benefits of using this in your own project if you are going
to be looking for jobs doing PHP or you work one now and maybe considering shifting in the future now you can learn composer and be ahead of the curve in 16 or 18 months or in 18 or 24 months I think if you're not using composer you're going to be
behind shops that use laravel stops uses and framework to Symphony framework you're going to start see the seeing them asking you know are you familiar with composure or are you comfortable with it and so by learning about using composer now you're
ahead of the curve we put that on your resume makes it a little more attractive and let's take a look at the Battle of days how do we install projects using PHP go get library X from location Y my project requires plug in a plug-in be and plug-in see Google
where is plug in a where it's plug-in be you go get the plug-in does this plug-in work with this version of the framework I don't know you go get it and you upgrade the framework the maybe the plug-in has been upgraded since then go download it no
it doesn't where do I find the old one so now you can either email the developer maybe they have an old version it might be hard to figure out even if the what version the plugin works with or what library conflicts there are you could maybe dig through
the repository to find an old one if you have access to the repository but this is pretty tricky this is pretty tricky without knowing specifically what version you're looking for I didn't notice relied on PHP 5 dal 4 i've had a situation where
i was working with I forget exactly what dot version of PHP it is at a situation where i was developing on my local box started using anonymous closures in PHP a new php5 feature and I was like wow great this is so I'm so smart I'm so clever i'm
using new features i go put in production things start breaking and i realize that i'm using features that are two new because my production box is PHP five dot one or something like that and so use composer declare package dependencies then you can know
[ ... ]
Nota: se han omitido las otras 4.391 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.