- I am developing a blog as a custom package for Laravel 5.3.
- So far I have got the routes, controller, models and migrations working.
- I am now working on the CRUD. For the forms I thought I could use this: https://laravelcollective.com/docs/5.3/html
- I have installed the package (laravelcollective) with composer.
- The dependency is in the composer.json file. The files are in my package's vendor folder. I have also tried to run
composer dump-autoload -o
Here is my composer.json for my blog package.
{
"name": "revalgovender/laravel-blog",
"description": "This is a simple blog for Laravel5",
"license": "MIT",
"authors": [
{
"name": "Reval Govender",
"email": "reval.govender23@gmail.com"
}
],
"autoload": {
"psr-4": {
"RevalGovender\\LaravelBlog\\": "app/"
}
},
"require-dev": {
"phpunit/phpunit": "^5.5"
},
"require": {
"laravelcollective/html": "5.3.*"
}
}
I have looked everywhere and people suggest to do the following:
public function register()
{
// Bind the app.
$this->app->bind('blog', function ($app) {
return new Blog;
});
// Register LaravelCollective Form Builder.
$this->app->register('Collective\Html\HtmlServiceProvider');
$this->app->alias('Form', 'Collective\Html\FormFacade');
$this->app->alias('Html', 'Collective\Html\HtmlFacade');
}
I currently get the following error everywhere:
FatalThrowableError in Application.php line 610: Class 'Collective\Html\HtmlServiceProvider' not found
Really not sure where I am going wrong.
I have tried bind instead of register:
$this->app->bind('Collective\Html\HtmlServiceProvider');
But this time I get the following error:
Class 'Collective\Html\FormFacade' not found
I have spent 3hours trying to resolve this. I have even opened a StackOverflow post and no one can help with this.
http://stackoverflow.com/questions/39985015/cant-register-my-custom-packages-dependency-in-laravel5-3