I'm trying to develop my first package but I already struggle trying to do so. I've followed two tutorials and done everything exactly as described however I'm getting:
Class 'Krenor\Ldap\LdapServiceProvider' not found
My folder structure :
project
- app
- ...
- packages
-- krenor
--- ldap-auth
---- src
----- LdapServiceProvider.php (within src/)
---- composer.json (outside src/)
My composer file looks like this :
{
"name": "krenor/ldap-auth",
"description": "Authentication via LDAP and Laravel 5.1.x",
"type": "project",
"license": "MIT",
"authors": [
{"name": "MyName","email": "MyMail"}
],
"require": {
"php": ">=5.5",
"laravel/framework": "5.1.*"
},
"autoload": {
"psr-4": {
"Krenor\\Ldap\\": "src/"
}
}
}
And my Provider File :
<?php
namespace Krenor\Ldap;
use Illuminate\Support\ServiceProvider;
class LdapServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
dd('I am alive');
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
dd('I am alive, too!');
}
}
After creating the json file I've went into my project root folder and did composer dump-autoload
Also I've made sure that I added 'Krenor\Ldap\LdapServiceProvider'
to the providers
array in /config/app.php.
Am I missing something here?
src/Krenor/Ldap/LdapServiceProvider.php
– yangqiKrenor/Ldap
, which is thesrc/
. And starting from the base line, you should have the correct structure, which what I pointed out earlier. – yangqi