Hi to all!
I want to create a test package. As in example, my test service is located in "vendor\test" directory (filename TestServiceProvider.php)
<?php namespace Test;
use Illuminate\Support\ServiceProvider;
class TestServiceProvider extends ServiceProvider {
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
}
}
and add a
'providers' => [
'Test\TestServiceProvider',
],
But when i run an application, it show me
FatalErrorException in compiled.php line 6444:
Class 'Test\TestServiceProvider' not found.
How to fix this?
PS. php composer.phar dump-autoload was executed, but the same error.
Thanks in advance.
Are you creating the test folder inside vendor folder ? It's not a good very idea to create your own folders inside vendor folder. What i normally do is create a folder call it "Lib" on the same level as app folder and add it to composer.json so composer will generate autoload namespaces for my library.
also the preferred method of file structure is
/app
/vendor
/yourname
/library
/esomkin
/test
your class namespace should be <?php namespace Esomkin/Test;
astroanu said:
Are you creating the test folder inside vendor folder ? It's not a good very idea to create your own folders inside vendor folder. What i normally do is create a folder call it "Lib" on the same level as app folder and add it to composer.json so composer will generate autoload namespaces for my library.
also the preferred method of file structure is
/app /vendor /yourname /library /esomkin /test
your class namespace should be <?php namespace Esomkin/Test;
It's mostly clear, but some moments in dark :) Can you give me an example of creating simple package in Laravel 5?
I found http://kodeinfo.com/post/laravel-4-5-package-development and http://stackoverflow.com/questions/28378460/laravel-5-package-development, but as I know workbench is removed from Laravel 5, so I want to solve my problem without workbench.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community