Not found Class 'Jenssegers\Agent\Agent' not found in Laravel - laravel

I have tried many times to install laravel on ubuntu 18.04. but there is a error showed in terminal. Please help me how to solve this.
user#user:/opt/lampp/htdocs/project$ php artisan serve
In constants.php line 4:
Class 'Jenssegers\Agent\Agent' not found

Autoloading
You have to be sure, that your autoloading file is up to date.
Also, be sure that all packages from your composer.json are installed currently.
composer install will take care of both.
Wrong class name
If you have checked the above the issue could be, that the autoloader is looking for a class name, that doesn't exists due to discrepancy between the filename and classname. E.g. you called the file "UserAgent.php", but the class name inside the file is "Agent".

you can run composer install to fix the error. it works for me.

Related

Why are there naming collisions in Composer's vendor folder? (between bin and hhvm)

I have been learning to use hacklang and hhvm and I have went about using composer and installing all the needed packages as
composer require hhvm/hsl hhvm/hhvm-autoload
composer require --dev hhvm/hhast hhvm/hacktest facebook/fbexpect
I have also setup the .hhconfig aswell as the hh_autoload.json and hhast-lint.json
However there is a naming collision between the Vendor/bin and Vendor/HHVM
Can anyone explain why this is happening or how to fix it?
This happens because composer copies vendor/vendor/package/bin/file to vendor/bin/file, causing symbols in vendor/vendor/package/bin/file to be defined twice. IT IS EXPECTED.
to avoid naming issues, add the following to your .hhconfig :
ignored_paths = [ "vendor/.+/tests/.+", "vendor/.+/bin/.+" ]

Compiled Services Class Has been removed Composer error laravel 5.4

Dears whenever i want to add any Packeg using composer i face below error
"Compiled Services Class Has been removed"
I search many solution like "composer update" etc but still i face this problem
due to this error my working is stop.
kindly help me whats the original solution.
thats the composer installation problem? or what ?
The message The compiled services file has been removed. is a info message from the clear compiled command: php artisan clear-compiled.
It is called from php artisan optimize that runs on every composer update or install.
The message is only a info reporting that the file bootstrap/cache/services.php has been removed.
The services.php file will be reconstructed at the next request.
So at the end its a normal info message.
I have encountered the same problem.
Just remove the "Vendor" folder then install the composer. It worked fine for me.

Class 'Stripe\Stripe' not found error in PHP

I installed laravel and composer and created my first project in laravel. I want to integrate stripe using PHP. When I try to execute my first project in localhost I take this message:
Fatal error: Class 'Stripe\Stripe' not found in C:\xampp\htdocs\laravel\stripe\public\elda.php on line 21
To include the stripe libraries, I inserted inside the composer.json file the code from the API library for PHP. Here is an image of my composer.json file:
I run composer install in cmd and this is the output:
You may be getting outdated dependencies. Run update to update them.
I run composer update and the output is the error in the image below:
Can someone help me to solve this error?
Well, sorry did not make a comment of your post, but I have not enough points to do so. But you need to run composer install in the terminal after that includes a new package.
I had the same issue, but when I ran this command my issue is resolved.
composer require stripe/stripe-php
I hope this may help you, after you update your composer.

artisan not working in laravel 5.2 returning [ErrorException]

I'm getting problem when trying to execute php artisan "command". Does not matter the command.
For example, executing the command:
php artisan make:controller TestController
I have got the following result
[ErrorException]
Undefined variable: ths
What I have tried to do?
I have tried to update/install composer
composer update
composer install
composer dump-autoload
It's causing me a lot of problem for example I can't execute my migration in another words I can't take the next steps.
Would be great if someone has some idea how to fix that.
Thank's a lot
This error means that somewhere you have a class with $ths variable and it's not related to commands. I think you wrote some code and used $ths instead of $this. Check all last changes (custom commands, facades, service providers etc). Just fix it and commands will work again.
If you can't find $ths in your code, check Laravel error logs for extra info.
I suggest finding this in your code. If you use Sublime Text press:
The keyboard shortcut is Ctrl⇧+F on non-Mac (regular) keyboards, and ⌘⇧+F on a Mac.
And put $this on this variable instead of $ths

How to install Laravel 4 profiler

I'm a Ubuntu/git/composer noob, and I'm trying to follow the installation instructions here.
After running the php artisan config:publish loic-sharma/profiler command I get the following error:
PHP Fatal error: Class 'Profiler\ProfilerServiceProvider' not found in /var/www/epcr/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 158
I'm assuming the problem is that I haven't downloaded the code, but I'm not exactly sure how to go about doing that.
Most packages require you to manually add service provider in app/config/app.php. There is an array of providers inside.
Some providers require also facade alias.
So take a look at documentation, if it is provider, then it should be documented.
e.g.
'Miro\JSONSuite\JSONSuiteServiceProvider'
Try running composer dump-autoload
I needed to run composer update after I added the require to my composer.json file. After that I had a few permissions I needed to update and it worked after that.

Resources