Error trying to publish config file of laravel-livewire? - laravel

Reading laravel-livewire docs at
https://laravel-livewire.com/docs/2.x/installation
I tried to publish The Config File and I got unexpected results
$ php artisan livewire:publish
Command "livewire:publish" is not defined.
Did you mean one of these?
livewire:configure-s3-upload-cleanup
livewire:copy
livewire:delete
livewire:discover
livewire:make
livewire:move
livewire:stubs
stub:publish
sweetalert:publish
vendor:publish
Why so and which command have I use to to publish config file ?
I have :
"laravel/framework": "^7.0",
"livewire/livewire": "^1.3",
Thanks!

You have installed
"livewire/livewire": "^1.3",
and are referring to version 2 documentation
https://laravel-livewire.com/docs/2.x/installation
Use liverwire version 2 or version 1 documentation instead.
In case others wonder, the line "livewire/livewire": "^1.3" can be found in require section of the composer.json file in the project's root directory.

Related

Laravel ide-helper installed fine but doesn't generate

BarryVdh's ide-helper has been sucessfully installed to my Laravel project as the composer.json desribes:
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
...
},
"require-dev": {
...
"barryvdh/laravel-ide-helper": "^2.1",
"doctrine/dbal": "^2.9"
},
Added to providers in app/config as:
'providers' => [
...
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
],
I assume it partially works as the command php artisan ide-helper:meta generates .phpstorm.meta.php in the root folder, but the php artisan ide-helper:generate command fails with the following simple error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Parse error: syntax error, unexpected end of file
If I try to generate model info with the command php artisan ide-helper:models, asks for overwrite models or to write to _ide_helper_models.php instead, 'no' chosen, it fails and throws the same error above. However, if I add a model to the command (eg. php artisan ide-helper:models Order ), after choosing 'no' for overwrite the ide-helper generates the _ide_helper_models.php file without any relevant content, just the default comment block.
What to check in this case?
(phpStorm IDE, win10, Laravel 5.1, Xampp, PHP7)

Lumen first install - ReflectionException: Class redis does not exist

I am playing around with Lumen, I installed it via Lumen installer. After I do composer install, I try to use artisan but it throws the following error:
ReflectionException: Class redis does not exist in Container.php on line 752
My composer.json:
"require": {
"php": ">=7",
"ext-pdo_pgsql": "*",
"ext-soap": "*",
"guzzlehttp/guzzle": "^6.3",
"laravel/lumen-framework": "5.5.*",
"laravel/tinker": "^1.0",
"vlucas/phpdotenv": "~2.2"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^2.4",
"doctrine/dbal": "^2.5"
},
Thanks in advance.
I had the same.
Solution:
composer require illuminate/redis
Register it in bootstrap/app.php by calling
$app->register(Illuminate\Redis\RedisServiceProvider::class);
in the file, under Register Service Providers.
From this aricle.
From Lumen's official documentation at https://lumen.laravel.com/docs/7.x/cache :
Redis Support:
Before using a Redis cache with Lumen, you will need to install the illuminate/redis package via Composer. Then, you should register the Illuminate\Redis\RedisServiceProvider in your bootstrap/app.php file:
$app->register(Illuminate\Redis\RedisServiceProvider::class);
If you have not called $app->withEloquent() in your bootstrap/app.php file, then you should call $app->configure('database'); in the bootstrap/app.php file to ensure the Redis database configuration is properly loaded.

Yii2 Error: yii\base\UnknownMethodException: Calling unknown method: yii\web\UrlManager::addRules()

After todays update of composer dependencies (with composer update command) my Yii2 application became broken - It throws Unknown Method – yii\base\UnknownMethodException: Calling unknown method: yii\web\UrlManager::addRules()
After inspecting vendor/yiisoft/yii2/web/UrlManager.php file I found that there is no method addRule.
And the whole entire class UrlManager is different from the class in the repository.
My composer.json:
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"yiisoft/yii2-gii": "2.0.0-beta",
"claudejanz/yii2-mygii": "*",
"kartik-v/yii2-grid": "dev-master",
"kartik-v/yii2-builder": "dev-master",
"2amigos/yii2-switch-widget": "*",
"yiisoft/yii2-jui": "*",
"DsXack/yii2-underscore": "*",
"2amigos/yii2-editable-widget": "*",
"warrence/yii2-kartikgii": "*"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*"
},
I think they have changed the way some libraries are loaded through composer.
To solve it:
Add to composer.json
"extra": {
"asset-installer-paths": {
"npm-asset-library": "vendor/npm",
"bower-asset-library": "vendor/bower"
}
}
and run:
# php composer.phar global require "fxp/composer-asset-plugin:1.0.*#dev"
# php composer.phar update --dev
More info: Issue on Github and Issue on Github
Full credit to: #githubjeka and #SonicGD
Here is an explaination of why this happened:
I think this is again the composer dependency resolver doing unexpected things:
you require yiisoft/yii2 in your composer.json but do not have the composer asset plugin installed.
then the dependency resolver does not find packages with vendor bower-asset so it looks for other versions of yiisoft/yii2 that do not have conflict
The result is to install the beta version of yii2 to be installed
The correct solution as already mentioned is to install the composer-asset-plugin:
php composer.phar global require "fxp/composer-asset-plugin:1.0.*#dev"
It seems the update went totally wrong, since the files are different from the ones on github - several functions missing.
What i had to do to get "rid" of this error:
Copy the code from the repository in your local files:
https://github.com/yiisoft/yii2/blob/master/framework/web/UrlManager.php
https://raw.githubusercontent.com/yiisoft/yii2/master/framework/helpers/BaseHtml.php
This solved it for the moment for me.
Like ricardgf says, read this:
https://github.com/yiisoft/yii2/blob/master/docs/guide/start-installation.md
then run:
composer.phar global require "fxp/composer-asset-plugin:1.0.*#dev"
and
composer.phar update --prefer-source --no-interaction
ok I solved the problem installing yii2 in this way :
composer global require "fxp/composer-asset-plugin:1.0.*#dev"
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
Try to update your composer.json into following way:
"require": {
"yiisoft/yii2": "*"
},
in project directory, write this command-
php composer.phar update

Illuminate\Session\SessionInterface not found

I am trying to run Laravel 4 application in Google App engine. I am following this tutorial but the problem is that when I run it by using cmd
C:\Program Files (x86)\Google\google_appengine>python dev_appserver.py --skip_sdk_update_check=yes --port=8080
--admin_port=8000 --php_executable_path=C:\wamp\bin\php\php5.4.12\php-cgi.exe C:\laravel-test\laravel
it shows the following error:
Fatal error: Interface 'Illuminate\Session\SessionInterface' not found in C:\laravel-test\laravel\bootstrap\compiled.php on line 7301
compiled.php: http://laravel.io/bin/ekP5m
I Also got this error during update using composer.In the composer.json file. there should not include two require parts
ex : --- this is not working
"require": {
"laravel/framework": "4.0.",
"neoxia/laravel-openssl-encryption": "1.0."
},
"require": {
"evernote/evernote": "dev-master"
},
this will work
"require": {
"laravel/framework": "4.0.",
"neoxia/laravel-openssl-encryption": "1.0.",
"evernote/evernote": "dev-master"
},
please check your file and make sure about that i think this will work

How to get list of all installed packages along with version in composer?

I have been working on a project using Symfony 2.1 on my local machine. I have uploaded it to my server but when I try and install the vendor bundles using Composer, I'm getting a lot of dependency errors. Presumably this is something to do with the latest version of Symfony just being released and my composer.json file not specifying exact version numbers.
Is there any way I can quickly display the version numbers of everything on my local machine?
Here is my composer.json file (which worked fine until a few days ago):
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"sonata-project/admin-bundle": "*",
"sonata-project/cache-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"stof/doctrine-extensions-bundle": "1.1.x-dev",
"sonata-project/user-bundle": "dev-master",
"sonata-project/easy-extends-bundle": "dev-master",
"friendsofsymfony/user-bundle": "2.0.x-dev",
"friendsofsymfony/jsrouting-bundle": "*",
"liip/imagine-bundle": "*",
"simplethings/form-extra-bundle": "dev-master",
"antimattr/google-bundle": "dev-master",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"genemu/form-bundle": "2.1.*",
"behat/behat": "2.4.*#stable",
"behat/mink": "1.4.*#stable",
"behat/symfony2-extension": "*#stable",
"behat/mink-extension": "*#stable",
"behat/mink-selenium2-driver": "*#stable",
"behat/mink-browserkit-driver": "*",
"liip/functional-test-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"minimum-stability": "dev",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web"
},
"config": {
"bin-dir": "bin/"
}
}
You can run composer show -i (short for --installed).
In the latest version just use composer show.
The -i options has been deprecated.
You can also use the global instalation of composer: composer global show
To list the globally installed composer packages:
composer global show -i
List installed dependencies:
Flat: composer show -i
Tree: composer show -i -t
-i short for --installed.
-t short for --tree.
ref: https://getcomposer.org/doc/03-cli.md#show
If you only want to check version for only one, you can do
composer show -- twig/twig
Note that only installed packages are shown by default now, and installed option is now deprecated.
The behaviour of this command as been modified so you don't have to pass the -i option:
[10:19:05] coil#coil:~/workspace/api$ composer show -i
You are using the deprecated option "installed".
Only installed packages are shown by default now.
The --all option can be used to show all packages.
Ivan's answer above is good:
composer global show -i
Added info: if you get a message somewhat like:
Composer could not find a composer.json file in ~/.composer
...you might have no packages installed yet. If so, you can ignore the next part of the message containing:
... please create a composer.json file ...
...as once you install a package the message will go away.
With composer-runtime-api 2.0+ there is a new InstalledVersions class with some static methods to see things programmatically.
For example:
// To list all packages (`string[]`)
\Composer\InstalledVersions::getInstalledPackages();
// To list every details of every packages
\Composer\InstalledVersions::getAllRawData();
More information: https://getcomposer.org/doc/07-runtime.md#installed-versions
If you want to install Symfony2.2, you can see the complete change in your composer.json on the Symfony blog.
Just update your file according to that and run composer update after that. That will install all new dependencies and Symfony2.2 on your project.
If you don't want to update to Symfony2.2, but have dependency errors, you should post these, so we can help you further.
Is there a way to get it via $event->getComposer()->getRepositoryManager()->getAllPackages()

Resources