Laravel - Can't install User Agent package - php

After failing many times trying to get Mobile Detect to work I figured this would be easier: https://github.com/jenssegers/laravel-agent/
I followed the simple steps and it says the class can't be found. What did I miss?

Ok, so I started from scratch and used dump-autoload on both composer and artisan before adding the respective code to app/config/app.php and it worked.

Related

Can't install Laravel Socialite via composer

I'm trying to require Laravel Socialite following the composer command in the DOCs but it's showing me the below error. Anyone knows what to do?
I'm using Laravel 9 and I don't think it's related to anything in my project so no need for code snippets.
hitting composer require laravel/socialite doesn't seem to work.
It was a network issue. I restarted my internet and it worked.

Is there a way to remove algolia/scout from laravel?

im am new to laravel and I recently installed Alogila on my Laravel application as I was working on a searching functionality using Laravel scout. The command I typed was composer require algolia/scout-extended
I am getting an error saying Impossible to connect, please check your Algolia Application Id.
Since I have decided to not have a searching functionality in my application, I would like to remove algolia from my app. I am unsure of how to do this, any help would be much appreciated.
You have two way to do that
first way
run the command
composer remove algolia/scout-extended
Second way
remove it from your composer.json file
then run the command
composer update

Laravel 5.2: Class "Illuminate\Html\HtmlServiceProvider" not found during composer installation

So I've been trying to install the LaravelCollective/Html package via composer update (already added "laravelcollective/html": "5.2.*" to the project composer.json file), but I keep getting this...
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Illuminate\Html\HtmlServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with error code 1
It seems I need to update app.php, but only after the install I can't get out of.
Thanks in advance.
(Oh and I'm using Windows, if that's of any importance. And yes, I did look for answers, but most were either relative to people having trouble after install or wrongly assuming they were)
So, I ended up finding the answer myself. I really dislike when I ask for help and end up not needing any, but this answer might be useful for others thinking the same way as I did.
Some answers I looked for said something about using composer dump-autoload after installation. I didn't try this step because I was fixated on the installation failing, and assumed it only worked if the install itself did. But then I decided to go with it, then retried composer update and nothing happened (maybe a sign there was nothing broken to fix). Then I edited the config/app.php file as explained on the docs and, surprisingly, it started working. I still might need to test it a little, but for now it seems nothing's broken.

laravel command not found while using laravel command

I've recently installed composer and also installed laravel installer from composer from the commmand line just like they said in laravel documentation.
But when I used the laravel command on the command line, it show error:
sh.exe": laravel: command not found
I also added environment variable in the path variable.
~/.composer/vendor/bin
But still the same error occurs while using the laravel command.
I'm a laravel newbie and I'm stuck in laravel installation.I've searched lot of times but still could not get the solution. I've read lot of users' questions with the same problem and used their solutions but still could not fix this.
Your path /c/xampp/php:~/.composer/vendor/bin is definitly wrong. Either you have to fix it (should be something like C:/{path_to_your_composer_directory}) or you can simply use composer create-project laravel/laravel --prefer-dist to install a new laravel project.
I would go with the 2nd option, because you don't have to configure something else.
On windows system, please remove . from path (just before .Composer)

Laravel setup project file fails

I've searched many answers to this problem, and a alternative solution to this project to still get what I try to achieve, but I want to know why it is not working the 'regular' way, and if it is possible to fix it somehow. I checked out this post where I found my alternative solution.
I installed laravel and I'm trying to create a project with laravel. However, when I run this command
composer create-project laravel/laravel cms
I get the following error: [InvalidArgumentException] - Composer could not find the config file
I followed all installation settings via a tutorial, created the composer enviroment variable, so those settings should be correct. Does somebody know why this is not working and how I might be able to fix this?
Edit: To clarify, as Joe commented, composer commands do work.
first, run the following command:
composer global require "laravel/installer=~1.1"
then, add ~/.composer/vendor/bin to your PATH. this way your system knows where the laravel installer is.
When this is done, you can simple use the following command to make a new project:
composer create-project laravel/laravel --prefer-dist
I had this problem myself since i was used to use composer to init a laravel project. However, after setting up this installer, i honestly love it. It has a bunch of neat options you can use ;-)
For more info, look here

Categories