vendor class not found in laravel - php

I use unisharp file manager in my project. on my local machine everything works fine, but on remote server it throws error [Symfony\Component\Debug\Exception\FatalErrorException] Class 'Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider' not found
in config/app.php everything's correct
/*FileMananger*/
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
Intervention\Image\ImageServiceProvider::class,
/*CKEditor*/
Unisharp\Ckeditor\ServiceProvider::class,
there is directory unisharp in vedor(so all files and directories are there). when i try to run composer install/update i get this error again. so everything in its right place, but laravel doesn't see this class.
comoser.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.3.*",
"maatwebsite/excel": "~2.1.0",
"appzcoder/crud-generator": "^1.2",
"laravelcollective/html": "^5.3",
"lavary/laravel-menu": "dev-master",
"nesbot/carbon": "^1.21",
"laracasts/flash": "^2.0",
"spatie/laravel-medialibrary": "^3.11",
"firebase/php-jwt": "^4.0",
"doctrine/dbal": "^2.5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Http/helpers.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"
}
}

Try to comment those lines in config/app.php and run composer require unisharp/laravel-filemanager again.
You can't set up service providers before they are downloaded through composer.

You need to run:
composer require unisharp/laravel-filemanager

Make sure your config/app.php unisharp providers is matched with the content in folder vendor unisharp composer.json
check below:
Config/app.php
vendor/unisharp-composer.json

the solution is very easy :)
just make sure you have this in your service provider:
Unisharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,
not this one:
UniSharp\Laravelfilemanager\LaravelFilemanagerServiceProvider::class,

Related

why composer update causes laravel app to fail on redirects

I have a laravel app (version 5.5) that I have been developing for months.
For the longest time I could add new libraries in my composer.json file and run "composer update" so it would build a new composer.lock file and everything worked just fine. But now when ever I run composer update and I restart my laravel app, any thing I do which would cause the site to attempt a "redirect" (such as login or logout) produces the following error:
Type error: Argument 1 passed to Laravel\Lumen\Http\Redirector::__construct() must be an instance of Laravel\Lumen\Application, instance of Illuminate\Foundation\Application given, called in ... (depends on where I am doing a redirect)
so I am sure this must be caused by some package not properly updating. So if I simply delete the entire ..\vendor folder and then run composer install, it will fix the issue. Site will run fine for months then if I run composer update again the error comes back. So I know it is being caused by one of the packages being included. Does anyone know what to do to try to figure out what, or how or which package is causing this error?
In case you need it here is a copy of the composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"anhskohbo/no-captcha": "^2.3",
"askedio/laravel5-soft-cascade": "^5.5",
"aws/aws-sdk-php": "^3.25",
"aws/aws-sdk-php-laravel": "^3.1",
"doctrine/dbal": "^2.5",
"intervention/image": "^2.3",
"laravel/framework": "5.5.*",
"laravel/socialite": "^3.0",
"laravel/tinker": "~1.0",
"laravolt/avatar": "^1.8",
"league/flysystem-aws-s3-v3": "^1.0",
"pbmedia/laravel-ffmpeg": "^1.1",
"php-ffmpeg/php-ffmpeg": "^0.9.5",
"sammyk/laravel-facebook-sdk": "^3.5",
"braintree/braintree_php" : "3.27.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~6.0",
"filp/whoops": "~2.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"app/Http/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"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"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"#php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true
}
}
===============================================
Updated: To be clear I have searched my code for Laravel\Lumen and I find no references but when I search the \vendor folder I get several packages including Amazon AWS which does reference that (see below).... But how do I fix those packages?
Laravel\Lumen theres your answer. How come Lumen is being used?
Somewhere in your code you're importing the wrong class. The exception is stating that a Illuminate\Foundation\Application is being created, which is correct, but somewhere there is a type hint expecting Laravel\Lumen\Application. Do a search through your code for Laravel\Lumen\Application and you'll probably find the problem.

PHP Composer lock file interoperability between Windows and Linux

Is it safe to create a composer lock file in Windows, use that lock file in a server that runs on Linux (Centos 6.8 to be exact) and expect the same installed packages/functionality as long as PHP versions match between the 2? My current dev environment actually relies on Docker with containers that mimic our production server but I run into an issue if I use Composer on it. While it works fine, trying to get Laravel Dusk (an automated browser testing framework by the Laravel developers) to work headless in an acceptable manner on my Centos setup is a frustrating task. But that's a problem better fit as a separate question.
In comparison, it works fine on my host/Windows but I would have to run Composer there instead to generate the necessary bin .bat files since Dusk needs to make calls to /path/to/composer/bin/phpunit.bat on a Windows environment.
The following is how my composer file looks like (basically close to stock with some extra libraries)
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.6.4",
"laravel/framework": "5.4.*",
"guzzlehttp/guzzle": "~6.0",
"laravelcollective/html": "^5.3",
"imagine/imagine": "~0.5.0",
"predis/predis": "~1.0",
"dompdf/dompdf": "^0.7.0",
"laravel/dusk": "^1.0",
"laravel/browser-kit-testing": "^1.0",
"santigarcor/laratrust": "3.0.*",
"laravel/passport": "^2.0",
"dingo/api": "1.0.*#dev"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.0",
"symfony/css-selector": "3.1.*",
"symfony/dom-crawler": "3.1.*",
"barryvdh/laravel-ide-helper": "^2.2",
"deployer/deployer": "^4.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/",
"Tests\\": "tests/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"tests/BrowserKitTest.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"
}
}

Move Laravel project to hosting

I'm trying to move laravel project to host Virtualmin, I moved all folders in my Document root
HOME/
MYPWD/
APP/
BOOTSTRAP/
CONFIG/
DATABASE/
....
PUBLIC_HTML/
Inside PUBLIC_HTML I have the index.php with these lines:
require __DIR__ . '/../bootstrap/autoload.php';
$app = require_once __DIR__ . '/../bootstrap/app.php';
The login.php page work right, but after login, the browser return an error caused by recursively redirect. In logs I get this error:
exception 'ReflectionException' with message 'Class
App\Http\Middleware\isNotAuth does not exist' in
/home/mypwd/vendor/laravel/framework/src/Illuminate/Container/Container.php:734
I should change something else? Like namespace?
That's my composer.json file:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"doctrine/dbal": "^2.5",
"laravelcollective/html": "^5.2",
"symfony/event-dispatcher": "^3.2",
"psr/log": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"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"
}
}
While that's my .gitignore file:
/vendor
/node_modules
/public/storage
Homestead.yaml
Homestead.json
.env
I resolve myself the problem: server linux is case sensitive, so in Kernel.php I called middleware class with IsNotAuth, but filename was isNotAuth

Installation of package.json

i am unable to install this library from GitHub. [Minishlink/web-push]
I have Laravel 5 installed on my server, I want to install this in the Laravel directory (project). And will use the library via custom PHP.
I am facing below issues:
When I run composer require minishlink/web-push, I get below error:
When I run composer require mdanter/eec, I get below error
When I run composer require pargonie/rndom_compat, I get below error
Here is the composer.json file (I have not included the web-push file here as I am using the require command via putty, [Please correct me if I'm wrong])
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"guzzlehttp/guzzle": "~4.0",
"maatwebsite/excel": "~2.0.0",
"aloha/twilio": "^2.0",
"laravel/socialite": "2.0.*",
"ixudra/curl": "6.*",
"laracasts/utilities": "^2.1"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1",
"laracasts/utilities": "~2.0"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
This is the same type of issue as #17. It's not related to Minishlink/web-push. One of your dependancies is stuck in the past with paragonie/random_compat v1.1.5. You should check which one and ask the owner to update the composer.json. To fix this temporarily, in your composer.json, on your dev machine put:
"paragonie/random_compat": "dev-master as 1.1.5",
"minishlink/web-push": "^1.1"

Laravel RuntimeException Could not scan for classes inside "database" which does not appear to be a file nor a folder

I am trying to run command
composer update
getting this error message:
[RuntimeException]
Could not scan for classes inside "database" which does not appear to
be a file nor a folder
This is the code inside my composer.json:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*",
"jenssegers/mongodb": "^2.0",
"lucadegasperi/oauth2-server-laravel": "^5.1",
"laravelcollective/html": "5.2.*",
"davibennun/laravel-push-notification": "dev-laravel5"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}
We can resolve this issue by create database folder under our project root: <PROJECT_ROOT>/database. If we want to make sure all things are good to use, we can delete composer.lock file and run the composer update command again.

Categories