0

I struggle loading a fork for a package with composer. I am trying to integrate Swaggervel, a Swagger package for Laravel 5, into my project. The current dev-master has a bug which causes incompatibility to laravel 5.

BUT there is a fork on github https://github.com/mvpasarel/swagger-laravel which fixes this issue.

So this is how I try to point at the fork in my composer.json file.

"repositories": [
{
  "type": "vcs",
  "url": "https://github.com/mvpasarel/swagger-laravel"
}],

"require": {
    "laravel/framework": "5.0.*",
    "phpunit/phpunit": "~4.5",
    "jlapp/swaggervel": "dev-master"
}, ...

I read many posts in different communities to understand how to achieve what I want. This is so far my best shot, but unfortunately in my vendor/project/ folder I still see the "old source" from jlapp/swaggervel and not the updated source from mvpasarel/swagger-laravel.

Just for completion here is a part of my composer.lock

{
        "name": "jlapp/swaggervel",
        "version": "dev-master",
        "source": {
            "type": "git",
            "url": "https://github.com/mvpasarel/swagger-laravel.git",
            "reference": "6e75f294ffa65823247e1f9f9f88402a75aa14f5"
        },
        "dist": {
            "type": "zip",
            "url": "https://api.github.com/repos/mvpasarel/swagger-laravel/zipball/6e75f294ffa65823247e1f9f9f88402a75aa14f5",
            "reference": "6e75f294ffa65823247e1f9f9f88402a75aa14f5",
            "shasum": ""
        },
        "require": {
            "php": ">=5.3.0",
            "zircote/swagger-php": "*"
        },
        "type": "library",
        "autoload": {
            "psr-0": {
                "Jlapp\\Swaggervel": "src/"
            }
        },
        "license": [
            "MIT"
        ],
        "authors": [
            {
                "name": "jlapp",
                "email": "jordan@jordanlapp.com"
            }
        ],
        "description": "A great way to integrate Swagger into Laravel",
        "keywords": [
            "laravel",
            "swagger"
        ],
        "support": {
            "source": "https://github.com/mvpasarel/swagger-laravel/tree/master"
        },
        "time": "2014-11-20 21:43:03"
    },

Any idea what I am doing wrong? Thank you!

Christoph Beger
  • 135
  • 2
  • 14
  • Have you tried deleting the lock file, installed.json file, the package directory and then updating? – guessimtoolate Feb 22 '15 at 18:35
  • Yep I tried is several times. It doesn't work. It will only load the original source and not the source. I also followup [on this article](http://stackoverflow.com/questions/13325158/contributing-to-open-source-bundles-from-vendor-directory/27970559#27970559) but no solution. – Christoph Beger Feb 22 '15 at 19:35

1 Answers1

2

Here is how you should load a fork:

composer.json:

{   
  "repositories": [
    {
      "type": "git",
      "url": "git@github.com:mvpasarel/swagger-laravel.git"
    }   
   ],    
   "require": {
    "laravel/framework": "5.0.*",
    "jlapp/swaggervel": "dev-laravel5"   
   }
}

You will have to add the repository "url": "git@github.com:mvpasarel/swagger-laravel.git" of the fork and keep the name of the original package but add the "dev-" + name of the branch on the fork you want to load, in this case: "jlapp/swaggervel": "dev-laravel5"

This is how I use it, let me know if it works for you.

mvpasarel
  • 775
  • 5
  • 13
  • Thank you mvpasarel! It worked. I could include the fork. Unfortunately I cannot run php artisan config:publish jlapp/swaggervel. "config:publish" is an unknown method and my swagger.json in docs folder is not created. Any idea why? – Christoph Beger Feb 23 '15 at 21:46
  • In Laravel 5 the command `config:publish` is replaced by `vendor:publish`. You should run `php artisan vendor:publish --provider="path/to/SwaggervelServiceProvider"` – mvpasarel Feb 24 '15 at 06:34
  • Okay this works. But the JSON file is not created. For the route /docs I get and NotFoundHttpException, saying that /storage/docs/api-docs.json does not exist and in fact, it does not exist. Why is it not being created? am I missing something? Storage folder is writeable. – Christoph Beger Feb 24 '15 at 10:27
  • For me is working well. I think is an issue related to Laravel or something. This is what I am thinking of: 1) Have you added: `'Jlapp\Swaggervel\SwaggervelServiceProvider'`, to end of `config/app.php:providers` 2) What do you see if you run `php artisan route:list`? Is anything related to `docs/{page?}` or `api-docs` ? – mvpasarel Feb 24 '15 at 13:04
  • Lets move this to private tho, add me on skype: woazala. I will go with you thru package config, ok? – mvpasarel Feb 24 '15 at 13:07
  • Swaggervel now supports Laravel 5. – Jordan Lapp Apr 30 '15 at 22:41