Laravel 5.2 form module called error

Source: Internet
Author: User
Tags crypt

Error code

Call to undefined method illuminate\foundation\application::bindshared ()

Reason

The Form and HTML helpers has been deprecated in Laravel 5.0; The form module relies on the Laravel 5.0 framework, so it is still problematic to call in the default 5.2 framework, and now 5.2 has not been repaired, so it needs to be reinstalled.

Solve

1. Add a line "laravelcollective/html" to the require of the Composer.json file: "~5.0″ complete version

    "Require": {        "php": ">=5.5.9",        "laravel/framework": "5.2.*",        "illuminate/html": "^5.0",        " Barryvdh/laravel-ide-helper ":" v2.1.2 ",        " laravelcollective/html ":" ~5.0 "    },

Composer.json location in Laravel directory root layer

2. Then run the command

Composer Update

Mainly through composer to re-manage the files of the Laravel framework

Here is the update process

Composer Update> PHP artisan clear-compiledloading composer repositories with package informationupdating  Dependencies (including Require-dev)-removing Symfony/yaml (v3.0.1)-Installing Symfony/yaml (v3.0.2) Downloading: 100%-Removing Phpspec/prophecy (v1.5.0)-Installing Phpspec/prophecy (v1.6.0) downloading:100%-removing Phpun  It/phpunit (4.8.21)-Installing Phpunit/phpunit (4.8.23) downloading:100%-removing symfony/css-selector (v3.0.1) -Installing Symfony/css-selector (v3.0.2) downloading:100%-removing Symfony/dom-crawler (v3.0.1)-Installing SY Mfony/dom-crawler (v3.0.2) downloading:100%-removing Paragonie/random_compat (1.1.6)-Installing Paragonie/random _compat (v1.2.0) downloading:100%-removing symfony/console (v3.0.1)-Installing Symfony/console (v3.0.2) downl oading:100%-Removing Symfony/finder (v3.0.1)-Installing Symfony/finder (v3.0.2) downloading:100%-Removing Sy Mfony/debug (v3.0.1)-Installing SYMfony/debug (v3.0.2) downloading:100%-removing symfony/http-foundation (v3.0.1)-Installing Symfony/http-foundati On (v3.0.2) downloading:100%-removing symfony/event-dispatcher (v3.0.1)-Installing Symfony/event-dispatcher (v3. 0.2) downloading:100%-removing Symfony/http-kernel (v3.0.1)-Installing Symfony/http-kernel (v3.0.2) Downloadi ng:100%-Removing symfony/process (v3.0.1)-Installing symfony/process (v3.0.2) downloading:100%-Updating SYMF Ony/routing (v3.0.1 = v3.0.2) The package had modified files:m. Gitignore m annotation/route.php m change Log.md m compiledroute.php m exception/exceptioninterface.php m exception/invalidparameterexception.php m Exce ption/methodnotallowedexception.php m exception/missingmandatoryparametersexception.php m Exception/ resourcenotfoundexception.php M exception/routenotfoundexception.php-10 More files modified, choose "V" to view the ful L list Discard changes [Y,n,v,d,s,?]? Y Checking out 4686baa55a835e1c1ede9b86ba02415c8c8d6166-removing symfony/translation (v3.0.1)-Installing Symfony /translation (v3.0.2) downloading:100%-removing symfony/var-dumper (v3.0.1)-Installing Symfony/var-dumper (v3.0. 2) downloading:100%-removing laravel/framework (v5.2.12)-Installing laravel/framework (v5.2.16) Downloading: 100%-Installing laravelcollective/html (v5.2.4) downloading:100%writing lock filegenerating autoload files> php Artisan Optimizegenerating Optimized class loader

3. After the update is successful, modify the config/app.php file to add configuration:

#增加providers数组项  ' providers ' = [    //...    Collective\html\htmlserviceprovider::class,    //...  ], #增加alias数组项   ' aliases ' = [    //...]      Form ' = ' + Collective\html\formfacade::class,      ' Html ' = Collective\html\htmlfacade::class,    //...  ] ,

The following is the complete version

  ' Providers ' = [/* * Laravel Framework Service providers ... */Illuminate\auth\authser Viceprovider::class, Illuminate\broadcasting\broadcastserviceprovider::class, Illuminate\bus\busserviceprovi Der::class, Illuminate\cache\cacheserviceprovider::class, Illuminate\foundation\providers\consolesupportserv Iceprovider::class, Illuminate\cookie\cookieserviceprovider::class, Illuminate\database\databaseserviceprovi Der::class, Illuminate\encryption\encryptionserviceprovider::class, ILLUMINATE\FILESYSTEM\FILESYSTEMSERVICEP Rovider::class, Illuminate\foundation\providers\foundationserviceprovider::class, Illuminate\Hashing\HashSer Viceprovider::class, Illuminate\mail\mailserviceprovider::class, Illuminate\pagination\paginationserviceprov Ider::class, Illuminate\pipeline\pipelineserviceprovider::class, Illuminate\queue\queueserviceprovider::clas S, illuminate\redIs\redisserviceprovider::class, Illuminate\auth\passwords\passwordresetserviceprovider::class, Illuminate\Se Ssion\sessionserviceprovider::class, Illuminate\translation\translationserviceprovider::class, Illuminate\Va Lidation\validationserviceprovider::class, Illuminate\view\viewserviceprovider::class, Collective\Html\HtmlS        Erviceprovider::class, #注意, is here ' barryvdh\laravelidehelper\idehelperserviceprovider ',//Laravel IDE Helper /* * Application Service Providers ... */App\providers\appserviceprovider::class, App\provid Ers\authserviceprovider::class, App\providers\eventserviceprovider::class, App\providers\routeserviceprovide R::class,],/* |--------------------------------------------------------------------------|    Class Aliases |--------------------------------------------------------------------------| | This array of class aliases would be registered if this APplication | is started. However, feel free to register as many as wish as |    The aliases is "lazy" loaded so they don ' t hinder performance.    | */' aliases ' = [' App ' = Illuminate\support\facades\app::class, ' Artisan ' and ' = Illuminat E\support\facades\artisan::class, ' Auth ' = Illuminate\support\facades\auth::class, ' Blade ' =&gt ;     Illuminate\support\facades\blade::class, ' Cache ' = Illuminate\support\facades\cache::class, ' Config '        = = Illuminate\support\facades\config::class, ' Cookie ' = Illuminate\support\facades\cookie::class, ' Crypt ' and Illuminate\support\facades\crypt::class, ' DB ' = Illuminate\support\facades\db::cla SS, ' eloquent ' = Illuminate\database\eloquent\model::class, ' Event ' and Illuminate\support\facade S\event::class, ' File ' = = Illuminate\support\facades\file::class, ' Gate ' = ' Il 'Luminate\support\facades\gate::class, ' Hash ' = Illuminate\support\facades\hash::class, ' Lang ' = = Illuminate\support\facades\lang::class, ' Log ' = = Illuminate\support\facades\log::class, ' Mail        ' = = Illuminate\support\facades\mail::class, ' Password ' and Illuminate\support\facades\password::class, ' Queue ' = Illuminate\support\facades\queue::class, ' Redirect ' and Illuminate\support\facades\redi Rect::class, ' Redis ' = Illuminate\support\facades\redis::class, ' Request ' and ' Illuminate\support ' \facades\request::class, ' Response ' and Illuminate\support\facades\response::class, ' Route ' = Ill   Uminate\support\facades\route::class, ' Schema ' = Illuminate\support\facades\schema::class, ' Session '        = = Illuminate\support\facades\session::class, ' Storage ' = Illuminate\support\facades\storage::class, ' URL ' = = IlLuminate\support\facades\url::class, ' Validator ' = Illuminate\support\facades\validator::class, ' View '        = = Illuminate\support\facades\view::class, ' Form ' = Collective\html\formfacade::class, #注意, that's it. ' Html ' = Collective\html\htmlfacade::class, #注意, that's it],

Reference files:

https://laravel.com/docs/5.2/upgrade#upgrade-5.2.0

Https://laravelcollective.com/docs/5.1/html#installation

Http://stackoverflow.com/questions/34414389/fatalerrorexception-in-htmlserviceprovider-php-line-36-laravel

This article was authored by Peteryuan and licensed under the Attribution-NonCommercial use of 2.5 mainland China. Please contact the author and the author and indicate the source of the article before reprint or citation. Like a boy of God»laravel 5.2 error when calling form module

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.