2014年11月25日星期二

VG Tech Blog: Using Local Packages as Composer Dependencies


On the VG Tech blog this latest post shows you how to use local packages as dependencies in your Composer-enabled applications.



Composer changed pretty much everything when it comes to including dependencies in PHP projects. No more SVN externals or copying large library folders into your project. This is really great, but there's one thing I've been struggling to find a smooth process for; developing dependencies for your project. When implementing your project, the need for some module, library, service provider or something else will arise, and sometimes you'll have to implement it yourself. So, how to do that?


He starts with a list of three suggestions (including actually having the code in the project or mirroring the package) but suggests the last of the three: using a repository with a relative file system setup. He uses the "repositories" configuration option in the Composer config to define a "vcs" type and gives it a path to the package contents. He ends the post with the resulting output of the Composer install command, showing the package pulled in and being able to commit to it just like any other repo.


Link: http://tech.vg.no/2014/11/25/using-local-packages-as-composer-dependencies/

没有评论:

发表评论