-1

As soon i do composer install or composer update, prefere the install as the base script is from 2017. Then i get this.

    FatalThrowableError in Inflector.php line 70:
Class 'Doctrine\Inflector\InflectorFactory' not found
in Inflector.php line 70
at Inflector::createFactory() in Inflector.php line 58
at Inflector::getInstance() in Inflector.php line 279
at Inflector::singularize('members') in Pluralizer.php line 77
at Pluralizer::singular('members') in Str.php line 344
at Str::singular('members') in ResourceRegistrar.php line 268
at ResourceRegistrar->getResourceWildcard('members') in ResourceRegistrar.php line 91
at ResourceRegistrar->register('members', 'AdminController', array('names' => array('edit' => 'user.edit', 'destroy' => 'user.destroy'))) in Router.php line 290
at Router->resource('members', 'AdminController', array('names' => array('edit' => 'user.edit', 'destroy' => 'user.destroy'))) in ResourceRegistrar.php line 116
at ResourceRegistrar->Illuminate\Routing\{closure}(object(Router))
at call_user_func(object(Closure), object(Router)) in Router.php line 330
at Router->group(array('prefix' => 'panel/admin'), object(Closure)) in ResourceRegistrar.php line 119
at ResourceRegistrar->prefixedResource('members', 'AdminController', array('names' => array('edit' => 'user.edit', 'destroy' => 'user.destroy'))) in ResourceRegistrar.php line 83
at ResourceRegistrar->register('panel/admin/members', 'AdminController', array('names' => array('edit' => 'user.edit', 'destroy' => 'user.destroy'))) in Router.php line 290
at Router->resource('panel/admin/members', 'AdminController', array('names' => array('edit' => 'user.edit', 'destroy' => 'user.destroy'))) in Facade.php line 237
at Facade::__callStatic('resource', array('panel/admin/members', 'AdminController', array('names' => array('edit' => 'user.edit', 'destroy' => 'user.destroy')))) in web.php line 218
at RouteServiceProvider->{closure}(object(Router))
at call_user_func(object(Closure), object(Router)) in Router.php line 330
at Router->group(array('middleware' => 'role'), object(Closure)) in Facade.php line 237
at Facade::__callStatic('group', array(array('middleware' => 'role'), object(Closure))) in web.php line 255
at require('/data01/myserver/htdocs/routes/web.php') in RouteServiceProvider.php line 58
at RouteServiceProvider->App\Providers\{closure}(object(Router))
at call_user_func(object(Closure), object(Router)) in Router.php line 330
at Router->group(array('middleware' => 'web', 'namespace' => 'App\Http\Controllers'), object(Closure)) in Facade.php line 237
at Facade::__callStatic('group', array(array('middleware' => 'web', 'namespace' => 'App\Http\Controllers'), object(Closure))) in RouteServiceProvider.php line 59
at RouteServiceProvider->mapWebRoutes() in RouteServiceProvider.php line 38
at RouteServiceProvider->map()
at call_user_func_array(array(object(RouteServiceProvider), 'map'), array()) in Container.php line 508
at Container->call(array(object(RouteServiceProvider), 'map')) in RouteServiceProvider.php line 69
at RouteServiceProvider->loadRoutes() in RouteServiceProvider.php line 30
at RouteServiceProvider->boot() in RouteServiceProvider.php line 28
at RouteServiceProvider->boot()
at call_user_func_array(array(object(RouteServiceProvider), 'boot'), array()) in Container.php line 508
at Container->call(array(object(RouteServiceProvider), 'boot')) in Application.php line 769
at Application->bootProvider(object(RouteServiceProvider)) in Application.php line 752
at Application->Illuminate\Foundation\{closure}(object(RouteServiceProvider), '18')
at array_walk(array(object(EventServiceProvider), object(RoutingServiceProvider), object(AuthServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FoundationServiceProvider), object(NotificationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ViewServiceProvider), object(ImageServiceProvider), object(ImageValidatorServiceProvider), object(CashierServiceProvider), object(AppServiceProvider), object(AuthServiceProvider), object(EventServiceProvider), object(RouteServiceProvider), object(TranslationServiceProvider), object(ValidationServiceProvider)), object(Closure)) in Application.php line 753
at Application->boot() in BootProviders.php line 17
at BootProviders->bootstrap(object(Application)) in Application.php line 203
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 254
at Kernel->bootstrap() in Kernel.php line 145
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
at Kernel->handle(object(Request)) in index.php line 53

And i have no idea why it comes. I tought it was because of the update as then it takes the newest ones and so. But even with the install i get this.

Composer.json
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "intervention/image": "^2.3",
        "cviebrock/image-validator": "^2.0",
        "laravelcollective/html": "5.3.*",
        "laravel/cashier": "~7.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.0",
        "symfony/css-selector": "3.1.*",
        "symfony/dom-crawler": "3.1.*",
        "fahim/laravel5-paypal-ipn": "dev-master@dev",
        "maksekeskus/maksekeskus-php": "v1.4.2"
    },
    "autoload": {
        "classmap": [
            "database"
            
        ],
        "psr-4": {
            "App\\": "app/"
        },
    "files": [
        "app/helper.php"
       ]
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

The only thing i can not do is use the php 5.6 as my service provider does not go that low. The oldest one i can use is 7.0

1 Answers1

0
  1. I've compared your composer.json file with the official 'JSON' file for your Laravel version and it appears to be in good shape. Original Laravel v5.3.* composer.json file

  2. Please only run composer update if you have to. Learn about the difference between composer update and composer install from here. What are the differences between composer update and composer install?

  3. From your 'error log' it's complaining about a missing class Class 'Doctrine\Inflector\InflectorFactory' not found in Inflector.php line 70.

The file in question resides at testProject\vendor\doctrine\inflector\lib\Doctrine\Common\Inflector\Inflector.php. 'testProject' is my project name while trying to reproduce the problem.
Normally, this can easily be fixed by simply adding an import statement for the missing 'Class' which in my test case already exists. i.e use Doctrine\Inflector\InflectorFactory;
Original Inflector.php file in a fresh installation.

❌Since its generally bad practice to manually edit files in the vendor folder that reside in your project root directory, below is my suggestion.

Procedure

  1. Delete your composer.lock file from your project root directory.
  2. Delete the whole vendor folder from your project root directory.
  3. Open your terminal/PowerShell, ➡ navigate to your project root directory, ➡ run the command composer clear-cache
    This will delete all content from Composer's cache directories.
  4. Open your terminal/PowerShell, ➡ navigate to your project root directory, ➡ run the command composer update
    Wait for 'composer' to write a new lock file and to install the fresh dependencies.
    Make sure the file app/helper.php exists since I saw it in your customized composer.json file.
    I had to remove that declaration below from the customized composer.json file since I didn't have access to the app/helper.php file while testing.
// ...
,
    "files": [
        "app/helper.php"
       ]
// ...
  1. If the 'update' is successful, all should be well.
    In your project root directory, you can run the command php artian serve and navigate to the displayed output URL in your browser to confirm if the error has disappeared.
steven7mwesigwa
  • 5,701
  • 3
  • 20
  • 34