Laravel 5.2 - Adding laravelcollective/html 5.2 throws errors - php

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.*

Related

Geolocation package with laravel: Midnite81\Geolocation\GeoLocationServiceProvider' not found

I want to use the following package for geolocation with laravel.
https://github.com/midnite81/geolocation
I have done everything they wrote in their documentation but find an error
Midnite81\Geolocation\GeoLocationServiceProvider' not found
i am unable to solve this problem. Can't understand what's wrong. What i did, at first, write "midnite81/geolocation": "1.*" in the composer.json file.
"require": {
"php": ">=7.0.0",
"fideloper/proxy": "~3.3",
"laravel/framework": "5.5.*",
"laravel/tinker": "~1.0",
"midnite81/geolocation": "1.*"
},
After that run composer update. Then run composer dump-autoload -o. Then in the config/app.php file, put the following part in providers and aliases array.
'providers' => [
Midnite81\Geolocation\GeoLocationServiceProvider::class
];
'aliases' => [
'GeoLocation' => Midnite81\GeoLocation\Facades\GeoLocation::class,
];
then run the following command.
php artisan vendor:publish --provider="Midnite81\GeoLocation\GeoLocationServiceProvider"
Then got the error, Midnite81\Geolocation\GeoLocationServiceProvider' not found
Can't figure out what's wrong in it.
I verified and confirm the problem.
The problem is:
Midnite81\Geolocation\GeoLocationServiceProvider::class
You should change this into
Midnite81\GeoLocation\GeoLocationServiceProvider::class
Notice the difference Geolocation vs GeoLocation. It seems there is error in readme for this package on Github
I've already sent Pull request https://github.com/midnite81/geolocation/pull/2 to fix readme for this package

Laravel Call to undefined method Illuminate\Html\HtmlServiceProvider::style()`

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

Laravel 5.1 adding Form And Html Classes

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

How to install "vinelab/http" in laravel 5

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.

DatePicker issue in yii2

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']);?>

Categories