For two weeks I have been heavily developing a new web application based upon Laravel. Tonight I searched for an easy filtering solution like Zend_Filter so that the request strings are automagically trim’d, lowercased, and so on. Lucky me, the repository https://github.com/rmasters/filter is available with a composer.json but latest commit from 2013 is not compatible with Laravel 5.1. The compatibility fix would be trivial: editing two files in the composer.json and it is done. But how can I use my own fork on GitHub or my local cloned repository?
I learned, that I can add a repository reference to the composer.json of my application:
"repositories": [
{
"type": "vcs",
"url": "http://github.com/schakko/filter"
}
],
Additionally, I have to specify my development branch which contains the Laravel 5.1 fix (laravel51):
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laracasts/flash": "~1.3",
"cocur/slugify": "dev-master",
"rmasters/filter": "dev-laravel51"
},
It is important that the Git branch is named laravel51 and not dev-laravel51, otherwise you will receive an error like
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package rmasters/filter could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
Another neat feature is that Composer supports local repositories without any problems. During testing I changed my repository to
"repositories": [
{
"type": "vcs",
"url": "c:/ckl/projects/github/filter"
}
],
and had no longer to push my changes to the remote repository. The code has to be committed to local branch, of course.