I'm using Laravel for my project, I created a service provider and it's located in app/services/ToolboxServiceProvider.php
, and I added
'providers' => array(
....
'services\ToolboxServiceProvider',
);
in my app.php config file. Now when loading the app, it says the service provider cannot find, I know that something's wrong with my path setting in that providers array, question is: how to make it right? Thanks in advance.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.2.*"
},
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
},
"minimum-stability": "stable"
}
You should add into autoload
=> classmap
section of your composer.json
:
"app/services",
so it should look like:
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php",
"app/services",
]
},
In your provider file, at the beginning you should have:
<?php namespace services;
(in lower case).
And after those changes you should run:
composer dump-autoload
to rebuild classmap