Laravel 4 custom package not appearing in autoload_namespace.php

Laravel 4 custom package not appearing in autoload_namespace.php

I have tried to create a custom package by creating a workbench package in one of my laravel apps, committing it to github and then installing it in a different package. My problem is that the namespace map is not being added to autoload_namespace.php and the knock on effect of this is that the line Markfee\Responder\ResponderServiceProvider in my providers array causes the following error when i run:

php artisan dump-autoload

Error Output:

PHP Fatal error: Class 'Markfee\Responder\ResponderServiceProvider' not found in /media/sf_wwwshare/feenance/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157

The package can be found at:

I include the package with the following entries in my composer.json file

"repositories": {
  "responder": {
    "type": "package",
    "package": {
      "name": "markfee/responder",
      "description": "Simple responder class for responding with json from api",
      "version": "0.1.0",
      "source": {
        "type": "git",
        "url": "",
        "reference": "a7a24c82479fc01ec0c06833690bfd2eeee9e47d"
      }
    }
  }
},
"require": {
  "laravel/framework": "4.2.*",
  "markfee/responder": "0.1.*"
},

If anyone can shed any light I'd be very greatful. Please ask if you need any further details.


ANSWERS:


You did the complicated way by providing a package definition for that repository. If you do that, this package is a complete replacement for any composer.json in that repository, and this should only be used in case there is none.

You didn't add the autoloading definition into that package, so it is correctly missing in your autoloading.

Suggestion: Avoid using type:package in your own composer.json file. Simply use type:vcs if the repository already has a composer.json.

If you want to use the master branch just like a tagged version, you can add an alias in your require statement: "markfee/responder": "dev-master as 0.1.0". You could also clone that repo and tag the commit you want in your own local copy, and reference your own repo instead. Or try to convince the maintainer to tag a version and add his repo to packagist.org.


with help from Sven I got this working, the exact changes I made were to replace the original entry in my composer.json with the following. I didn't use an alias as I just want to include the master branch at the moment. Versioning and adding to packagist are my next task:

"repositories": {
  "responder": {
    "type": "vcs",
    "url": ""
  }
},
"require": {
  "laravel/framework": "4.2.*",
  "markfee/responder": "dev-master"
},


 MORE:


 ? Laravel 5 - Creating Artisan Command for Packages
 ? Laravel 5 - Creating Artisan Command for Packages
 ? Laravel 5 - Creating Artisan Command for Packages
 ? Create artisan commands for package Laravel 5
 ? How to call Model via artisan command in Laravel 5?
 ? Laravel 5 php artisan not running in Vagrant, missing vendor/services.json?
 ? Laravel 5 php artisan not running in Vagrant, missing vendor/services.json?
 ? Laravel 5 php artisan not running in Vagrant, missing vendor/services.json?
 ? How to use composer, artisan ...(Laravel) php commands manually
 ? Laravel artisan exception details