I'm currently in the process of trying to include this package in my Laravel app: https://github.com/tappleby/laravel-auth-token
I included "tappleby/laravel-auth-token": "0.3.*" in composer.json, like this:
"require": {
"laravel/framework": "4.2.*",
"intervention/image": "dev-master",
"laracasts/flash": "~1.0",
"laracasts/validation": "1.1.*",
"tappleby/laravel-auth-token": "0.3.*"
}
And I added 'Tappleby\AuthToken\AuthTokenServiceProvider' and 'AuthToken'=>'Tappleby\Support\Facades\AuthToken','AuthTokenNotAuthorizedException' =>'Tappleby\AuthToken\Exceptions\NotAuthorizedException' to app/config/app.php.
Afterwards I ran composer install. This is the way I always added packages, but now I get an error every time: [RuntimeException]
Error Output: PHP Fatal error: Class 'Tappleby\AuthToken\AuthTokenServiceProvider' not found in /var/www/example.com/htdocs/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
Goto bootstrap/cache folder and delete config.php
Then run
composer dump-autoload
As Marcin said you shouldn't use
composer install
but
composer update
Second thing remove all the lines added to app/config/app.php
First run composer update after that put those lines in app/config/app.php
Then run php artisan config:publish tappleby/laravel-auth-token in your command line
It should publish your configuration and now you should be able to use the relevant classes
Order is mandatory, run composer update then add the service provider and aliases to app.php
php artisan optimize:clear
composer install
If that don't work
remove composer.lock
remove vendor folder
composer install
You should run:
composer update
and not
composer install
When adding new dependency you should always use composer update to update your project and not composer install
Your config file may be cached. Remove all files from bootstrap/cache/*
after that run
composer install --optimize-autoloader --no-dev
php artisan config:cache
Related
I work with Symfony 5.4, docker env and GitLab.
When I run my pipeline at the command, composer install I have the following error:
In PluginManager.php line 762:
symfony/thanks contains a Composer plugin which is blocked by your allow-pl
ugins config. You may add it to the list if you consider it safe.
You can run "composer config --no-plugins allow-plugins.symfony/thanks [tru
e|false]" to enable it (true) or disable it explicitly and suppress this ex
ception (false)
See https://getcomposer.org/allow-plugins
I try
composer global config allow-plugins.composer/installers true
composer clearcache
composer self-update
composer update --no-plugins --noscripts
But nothing works and I got the same error ...
You can try to add this config to your composer.json.
"config": {
"allow-plugins": {
"symfony/thanks": true
}
}
don't know if it's the best solution or not, but you can go to your composer global dir and do remove it at all :)
cd ~/.config/composer
composer remove symfony/thanks
I have a project using symfony/flex in which I cannot run composer install or composer update. I also can't create a new composer project with symfony/flex as a dependency as the failure is the same. For example;
mkdir foo && cd foo && composer require symfony/flex -vvv
Always has the following output;
...
Package operations: 1 install, 0 updates, 0 removals
Installs: symfony/flex:v1.2.6
- Installing symfony/flex (v1.2.6): Reading /Users/me/.composer/cache/files/symfony/flex/17b622276922e6347ea129acd6238ae1c41d96b6.zip from cache
Loading from cache
Extracting archiveExecuting command (CWD): unzip -qq '/Users/me/projects/foo/vendor/symfony/flex/2064a553f7cdf064ba8c1b62c7087ec6' -d '/Users/me/projects/foo/vendor/composer/65215880'
Loading plugin Symfony\Flex\Flex
Downloading https://flex.symfony.com/versions.json
The download hangs for a few seconds at the point of downloading versions.json before silently failing. vendor/symfony/flex exists.
What could be the cause of this failure? My colleague can run the same command successfully so I'm assuming an issue with my local composer. I have attempted reinstall composer and clearing the cache with no success.
Edit: now when running composer update -vvv in an existing project I get the following output
...
Downloading https://repo.packagist.org/packages.json
Where it also hangs, so it looks like composer cannot download certain JSON files? Packages download fine so it doesn't look like a lack of internet.
Edit 2: I can also confirm using composer update --no-plugins does work within the existing project.
When composer isn't working as expected, you should reset it and update it like this. First
$ composer clearcache
Then update
$ composer self-update
Then run a diagnostic
$ composer diagnose
Then cd to where you have composer.json located and do
$ composer dump-autoload
Then
$ composer install
Should fix this issue. Another approach includes
$ composer update symfony/flex --no-plugins --no-scripts
Also, this can arise due to a conflict between symfony/flex and symfony/symfony. To remove that conflict follow these steps
$ composer remove symfony/symfony
then edit your composer.json file like
{
"require": {
"symfony/flex": "^1.0",
},
"conflict": {
"symfony/symfony": "*"
}
}
Old Flex infrastructure is being shut down, you need to update Flex to AT LEAST 1.17.1: symfony.com/blog/upgrade-flex-on-your-symfony-projects
To do that, you need to run:
composer update symfony/flex --no-plugins --no-scripts
Run this, solved my issue
> composer update symfony/flex --no-plugins --no-scripts
then keep this config in my composer.json
{
"require": {
"symfony/flex": "^1.1",
},
"conflict": {
"symfony/symfony": "*"
}
}
Since my experience is with the same issue and thus not deserving of a standalone Q&A, I'll just post it as an answer to this, as the core problem is exactly the same, Symfony flex servers being shut down.
In my dockered project, dependencies were not being installed during build and after some investigation I found out, that composer install would always fail due to being unable to reach the Symfony flex server. It looked like a DNS problem at first, but it ended up being a problem with Symfony flex servers being shut down and an old version (1.3) of "symfony/flex" in composer.json.
I did pretty much everything in the most upvoted answer, but
$ composer update symfony/flex --no-plugins --no-scripts
returned an error due to a dependency of the symfony/flex package hitting the API limit. However as suggested I created a Personal access token and everything went smoothly from there.
I had the same problem.
I added cloudflare dns 1.1.1.1 to my dns.
This solved it for me
I am trying to create a FOSUserBundle user using the command line tool:
php bin/console fos:user:create admin --super-admin
but I am systematically getting:
There are no commands defined in the "fos:user" namespace.
Any ideas? I can see CreateUserCommand.php in /vendor/friendsofsymfony/user-bundle/Command/
Update
I have tried to delete \vendor and to run composer install again, but to no avail.
My composer.json has "friendsofsymfony/user-bundle": "~2.0"
Finding
Apparently, it is a known issue: https://github.com/FriendsOfSymfony/FOSUserBundle/pull/2639#issuecomment-361059568
remove composer.lock file and then run
composer install again followed by
composer update or composer dump-autoload commands.
I have been trying to move my laravel app to production. I following below steps
1. git clone
2. composer install
3. set env variables
4. (artisan key:generate)
5. artisan migrate --seed
But when i ran composer install, am getting the following error
Class 'Collective\Html\HtmlServiceProvider' not found in vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
I know this error means, laravelcollective not added in composer.json and need to following steps as mentioned here
But i already have done the same thing in dev mode and now the composer.json has require "laravelcollective" and aliases in config/app.php.
My question is, do i need to the same thing what i have done in dev (resolving laravelcollective issue) for every new production instance that i am gonna set it up ?
if your project working fine locally, then you have to Run composer update commend under your project repo. did you uploaded vender folder?
Also try to upload(only) vender/composer folder into your vender, and then try to runcomposer installorupdate` command
update it in your composer.json file.
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"laravelcollective/html": "5.1.*"
},
then in run command 'composer update' after it add dependancy in you app/config/app.php file..
Try:
composer install --no-scripts
this should install all the dependencies without problem
I am trying to execute a migration to rename some columns and I got an exception.
As I read on the documentation I have to add the doctrine/dbal dependency to my composer.json file. How do I do that? Which is the correct composer.json file. I have many in my application. Is the one that is on the same level as the folders app,bootstrap, public and vendor.
If so how do I add that dependency. Do I have to download anything?
By the way im using easyphp, not wamp!
Edit 1
After doing that the console throws this error
1) To install dependency , run this command
composer require doctrine/dbal
2) For 'git' is not recognized error, either you don't have git installed or the PATH is not added in the environment variables.
Install git for windows.
To add this dependency open the composer.json at the root of your project (in the same level as app, public etc.) and in the require section add the doctrine/dbal package like:
"require": {
"laravel/framework": "4.1.*",
"doctrine/dbal": "v2.4.2"
},
Save the file and run composer update
Edit
You probably installed git with the default settings and it's not in your PATH env.
Open Git Bash (it was installed with git - you will find it in your programs) and do composer update. By the way it's far better that windows command prompt.
If you are getting error while running migration try this
composer require doctrine/dbal:2.*