I am new to Laravel and using Laravel 5.1.
FatalErrorException in 88e08cd08566357f572303974c44bc50 line 4: Class
'Form' not found.
For the above exception I did some changes in my project:
. "require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.",
"laravelcollective/html": "5.1."
},
Added in JSON and updated the JSON file.
In config/app.php:
'providers' => [ // ... Collective\Html\HtmlServiceProvider::class, // ... ],
In config/app.php:
'aliases' => [ // ... 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, // ... ],
I have added this aliases, but it's still showing the above error. Please can anyone help me?
just you have to autoload your composer file.Reason is you added new class to required array in composer.
composer dump-autoload
Source and help for composer
Related
I'm developing my first Larvel-based package. I want to include the Socialite package, so I put it like this in my composer.json file
"require": {
"laravel/socialite": "^2.0"
},
Now, how do I include the provider and the alias as you'd normally do in /config/app.php ?
I think by now I've read every stackoverflow there is about this matter, but nothing seems to work.
This is my package's serviceprovider:
public function boot()
{
include __DIR__.'/routes.php';
$this->app->register('Laravel\Socialite\SocialiteServiceProvider');
$this->app->alias('Laravel\Socialite\Facades\Socialite', 'Socialite');
$this->loadViewsFrom(__DIR__.'/../views', 'package-name');
$this->loadTranslationsFrom(__DIR__.'/../lang', 'package-name');
$this->publishes([
__DIR__.'/../views' => resource_path('views/vendor/package-name'),
]);
$this->publishes([
__DIR__.'/../database/migrations/' => database_path('migrations')
], 'migrations');
}
Result:
Class 'Laravel\Socialite\SocialiteServiceProvider' not found
UPDATE
"psr-4": {
"App\\": "app/",
"Rubenwouters\\CrmLauncher\\": "packages/rubenwouters/crm-launcher/src/"
}
In your package's service provider in register method you can do:
public function boot() {
$this->app->register(ClassOfScialiteServiceProvider);
$this->app->alias(FacedeClass, 'Alias');
}
EDIT
But first of all... To add your package in the right way (to the vendor that you can adding a requirments) you have to some how add it to the main composer.json - required list. You can do it with one of below:
1
Adding you package to the official composer repository (packagist)
2
Make your own composer repository like Satis
3
The easiest way is to add your git repo dependanci inside composer.json like:
"repositories": [
{
"type": "vcs",
"url": "git#your_repo/crm-launcher.git"
},
],
"require": {
(...)
"rubenwouters/crm-launcher": "dev-master"
}
OR
or just move your dependencies ("laravel/socialite": "^2.0") to the main composer.json. :)
Register Laravel\Socialite\SocialiteServiceProvider::class, to Config\app.php as providers and also
Register 'Socialize' => Laravel\Socialite\Facades\Socialite::class, to Config\app.php as aliases.
May be this will solve your problem.
I'm using Laravel v5.2 and have followed the instructions below to install laravelcollective/html, but it still throws errors:
Browser: FatalErrorException in ProviderRepository.php line 119: Call to undefined method Collective\Html\FormFacade::isDeferred()
Artisan: [Symfony\Component\Debug\Exception\FatalErrorException] Call to undefined method Collective\Html\FormFacade::isDeferred()
Also tried 5.2.*-dev, but get the same errors.
Hope someone can help!
Command:
composer require laravelcollective/html
Added to composer.json "require" group:
"laravelcollective/html": "5.2.*"
composer update
Added to config/app.php in providers group:
Collective\Html\HtmlServiceProvider::class,
In aliases group:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
I hope it is not too late, but maybe answer on your question will be useful for a future reference. So, here is step by step:
1) In the root of your laravel package open composer.json file in "require" group should be added this line:
"laravelcollective/html": "5.2.*"
It should look similar to:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.",
"laravelcollective/html": "5.2."
},
2) Open command prompt or Git Bash and update the composer with command:
composer update
The composer will update within about one or two minutes.
3) Open config/app.php add this line in providers group:
Collective\Html\HtmlServiceProvider::class,
and don't forget to separate the previous class by comma. It should look like:
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
Collective\Html\HtmlServiceProvider::class,
4) In the same file in aliases group add these alias:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
so it should look like:
'View' => Illuminate\Support\Facades\View::class,
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
I hope this will help to anyone who use Laravel 5.2.*
I'm using the laravel 5.1 framework on my centos6 host. I already used composer install illuminate/html, but calling HTML::style() results in this error: FatalErrorException in 7b06fa36a7460c71e5daf57645a3dbda line 12: Call to undefined method Illuminate\Html\HtmlServiceProvider::style()
My app config :
'aliases' => [
//more...
'HTML' => Illuminate\Html\HtmlServiceProvider::class,
'Form' => Illuminate\Html\FormFacade::class
],
'providers' => [
//more...
Illuminate\View\ViewServiceProvider::class,
Illuminate\Html\HtmlServiceProvider::class,
]
composer.json:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"illuminate/html": "5.*"
},
Such as {!! Form::open() !!} ... is well except HTML::style().
What should I do?
You have aliased invalid class.
Replace
'HTML' => Illuminate\Html\HtmlServiceProvider::class,
with
'HTML' => Illuminate\Html\HtmlFacade::class,
terminal
composer require "laravelcollective/html":"^5.2.0"
Next, add your new provider to the providers array of config/app.php:
'providers' => [
Collective\Html\HtmlServiceProvider::class,
],
Finally, add two class aliases to the aliases array of config/app.php:
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
If using Laravel 5 these have been moved and are now depreciated, and are no longer in the core.
They are now part of the Laravel Collective
Read here for what you should be using, and how to intall
https://laravelcollective.com/docs/5.2/html
I am following the documentation at
https://packagist.org/packages/vinelab/http
My composer.json :
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laravelcollective/html": "~5.0",
"vinelab/http": "dev-master"
},
my app.php in config
'providers' => [
...
/*
* Helpers from packalyst.com
*/
Vinelab\Http\HttpServiceProvider::class
],
'aliases' => [
...
/*
* Helpers from packalyst.com
*/
cURL' => Vinelab\Http\Facades\Client::class
],
Following all the steps diligently.
I run php composer update and get this error.
http://goo.gl/sOj2gG
I am a novice in laravel and composer and am learning my way through.
Thank you for the help guys !
It seems that you have Zjango package in your service provider, but your composer.json file doesn't seem to show it. It is trying to load a service provider that hasn't been loaded via composer.json.
try adding "zjango/laracurl": "dev-master" to your composer.json file and run composer update again.
You have to install the composer package before putting in the service provider.
Remove the provider from the array in config/app.php.
Run composer update.
Put the provider back into the array in config/app.php.
Hello I have installed date time picker from "https://github.com/2amigos/yii2-date-time-picker-widget"
I have put this into vendor/amigos/yii2-date-time-picker-widget-master
I have added following lines in my composer.json
"amigos/yii2-date-time-picker-widget" : "*" in require section
so it is finally
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"amigos/yii2-date-time-picker-widget" : "*"
},
but when I write following code,
<?= DateTimePicker::widget([
'attribute' => 'created_at',
'language' => 'es',
'size' => 'ms',
'clientOptions' => [
'autoclose' => true,
'format' => 'dd MM yyyy - HH:ii P',
'todayBtn' => true
] ]);?>
It says "Class 'DateTimePicker' not found"
for me it is working fine, it looks like you are missing some dependency.
So I think you should update Yii using composer(if composer is
installed) for example if you are using windows then go to ur
project directory in command prompt and run
composer update --prefer-dist
This should update all the dependencies include in your
composer.json.
Another point is that in my installation the folder is named as
2amigos instead of just amigos in every places please try changing the folder
name if that works.
Change it to right name:
2amigos/yii2-date-time-picker-widget
And then you have to update your autoloader:
composer dump-autoload
try adding
"2amigos/yii2-date-time-picker-widget" : "~1.0"
to composer.json file and update composer using
php composer.phar update
Reference: https://github.com/2amigos/yii2-date-time-picker-widget/issues/9#issuecomment-156999145
As bootstrap-datetimepicker is not registered in packagist.org, it is showing this error.
We can do following:
Steps:
Install smalot-bootstrap-datetimepicker#2.3.1 using following command
bower install smalot-bootstrap-datetimepicker#2.3.1
This will copy required files in \vendor\bower\smalot-bootstrap-datetimepicker directory.
Clone https://github.com/2amigos/yii2-date-time-picker-widget.git
Remove "bower-asset/smalot-bootstrap-datetimepicker": "2.3.1" from composer.json.
It should look like this after removing
"require": {
"yiisoft/yii2": "~2.0",
"yiisoft/yii2-bootstrap": "~2.0.0"
},
Commit changes using
git add .
git commit -m "remove dependency."
Update yii2's composer.json to following:
"repositories": [
{
"type":"vcs",
"url":"file://D:\\programs\\xampp\\htdocs\\ppd\\packages\\yii2-date-time-picker-widget-master"
}
],
"require": {
...
"2amigos/yii2-date-time-picker-widget": "dev-master"
},
Please change url according to path where you have cloned repo.
run composer update --prefer-source.
Now datetimepicker widget is installed.
How did you installed it? Don't try to download it and copy it into vendor.
https://github.com/2amigos/yii2-date-time-picker-widget
Installation
The preferred way to install this extension is through composer.
Either run
composer require 2amigos/yii2-date-time-picker-widget:~1.0
or add
"2amigos/yii2-date-time-picker-widget" : "~1.0"
to the require section of your application's composer.json file.
run
composer install
STEP -1
Run this command on Terminal at Project main folder
---->curl -s http://getcomposer.org/installer | php
STEP -2
Successfully installation after run this command
--->php composer.phar require kartik-v/yii2-widget-datepicker "*"
you can see this contant in advanced->composer.jason file
"kartik-v/yii2-widget-datepicker": "*"
If you can't see , you can missing some...
STEP -3
Define this library in views-> _form.php
use kartik\date\DatePicker;
STEP -4
And last define this given below code in your form at date field
<?= $form->field($model, 'xyz_field')->widget(DatePicker::ClassName(),
[
'name' => 'check_issue_date',
// 'value' => date('d-M-Y', strtotime('+2 days')),
'options' => ['placeholder' => 'Select issue date ...'],
'pluginOptions' => [
'format' => 'yyyy/dd/mm',
'todayHighlight' => true
]
]);?>
I suggest use the HTML DatePicker, it doesn't have problems and its easily to use
<?= $form->field($model, 'date_of_birth')->textField(['type' => 'date']);?>