mardi 3 novembre 2015

Add custom package to composer.json file

I have a custom package that is not uploaded on github or packagist and I need to add it to a Laravel 5.1 project.

This is my package folder structure:

Packages
   \_ christian
     \_ smsservice
       \_src
         \_ Facades
           \_ MySMS.php
         \_ SMSServiceServiceProvider.php
       \_ vendor
         \_ composer
         \_ autoload.php

I have edited my root composer.json to add the package:

"psr-4": {
    "App\\": "app/",
    "Christian\\SMSService\\": "app/Packages/christian/smsservice/src/"
},

Then I have added the service provider and the facade to the app.php file but when I try to use the package I get:

FatalErrorException in ProviderRepository.php line 146:
Class 'Christian\SMSService\SMSServiceServiceProvider' not found

But the ServiceProvider exists and the namespace is correct:

namespace Christian\SMSService;


use Illuminate\Support\ServiceProvider;
use Illuminate\Routing\Router;

class SMSServiceServiceProvider extends ServiceProvider {
  //Code
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire