I'm new to Laravel. I'm using Laravel 6 in VSCode and my first real app is not performing as desired. If I were writing Java or PHP, I would use a debugger to step-trace my way through the code to see what is happening where. What is the equivalent of that for VSCode and Laravel 6?
I've searched extensions and can't find any Laravel Debug extensions, at least not with those words in its name. I've searched YouTube for videos on debugging Laravel and came across one that talked about Laravel Debugbar, here. I installed it - or at least tried to - but something is not right; the Firefox developer tool says:
ReferenceError: PhpDebugBar is not defined
I don't see any channel for tech support at the Github page for this tool so I'm not sure what I've done wrong. How would I either fix the debugbar install or uninstall it altogether?
From what I can see in the video, this tool doesn't let me step-trace my way through the code anyway: it's more of a monitor that shows me information about the status of my code at various points. That, of course, could still be useful but it's not really what I want. Is there a true step-trace debugger for Laravel?
My laptop is a Windows 10 machine.
========================================================================
EDIT
I'm trying to follow the advice I was given. I tried to self-update composer but it seemed to already be up to date. I tried to remove and reinstall debugbar but that doesn't seem to have worked very well. Here is the output from that attempt which was done in a VSCode terminal:
PS C:\Laravel\Somers01> composer remove barryvdh/laravel-debugbar --dev
barryvdh/laravel-debugbar could not be found in require but it is present in require-dev
Do you want to remove it from require-dev [yes]? y
–-dev is not required in your composer.json and has not been removed
Dependency "laravel/framework" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "laravel/framework" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "laravel/framework" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Package "–-dev" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 2 removals
- Removing maximebf/debugbar (v1.16.1)
- Removing barryvdh/laravel-debugbar (v3.2.9)
Writing lock file
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> #php artisan package:discover --ansi
In ProviderRepository.php line 208:
Class 'Barryvdh\Debugbar\ServiceProvider' not found
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
PS C:\Laravel\Somers01> composer require barryvdh/laravel-debugbar --dev
[InvalidArgumentException]
Could not find package barryvdh/laravel-debugbar in a version matching –-dev
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
Is debugbar fully removed now? If not, how do I remove the rest of it so that I can try the install again? I'm very new to Laravel, Composer, Artisan and the rest so I have no experience to draw on.
That error suggests a dependency is missing. Did you install it using composer, following the guide in the documentation? But about your quesiton: I THINK Xdebug might have something like that.
It's not a Laravel specific library but a php extension with some integration with IDEs.
Related
i know this has already been asked but, i can't see what is going wrong without asking.
I've created a packagist for a custom code hosted on github.
Packagist : https://packagist.org/packages/claims/module-logger
Github : https://github.com/Minirock/claims-module-logger
But when i try to load it using composer, it says it can't find it.
composer require claims/module-logger
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Info from https://repo.packagist.org: #StandWithUkraine
In InitCommand.php line 785:
Could not find a version of package claims/module-logger matching your minimum-stability (dev). Require it with an explicit version constraint allowing its desired stability.
I'm pretty sure this has to do with composer version but, how can i check if my package is available for composer 1 and / or 2. If not available for composer 1 (which is mandatory in my case) how can i make it accessible ?
I also tried specifying the version
composer require claims/module-logger:dev-main
Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
Info from https://repo.packagist.org: #StandWithUkraine
In InitCommand.php line 792:
Could not find package claims/module-logger.
Did you mean this?
claims/module-logger
I has exactly the same problem.
I updated my composer version (using composer self-update).
I confirm the problem persist.
The github : https://github.com/j-barth/test
The packagist : https://packagist.org/packages/jbarthes/test
Thank you
I have installed php 8.0.8 on my local computer. Laravel new projects work perfect. But when I try to run Old projects it shows me error. When I try to run command
composer install
It gives me the error below:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
To enable extensions, verify that they are enabled in your .ini files:
- C:\xampp\php\php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
When I run:
composer dump-autoload
It shows this error:
Generating optimized autoload files Class App\Http\Controllers\Vendor\OrderController
located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Controllers\temp\OrderController.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Http\Resources\profile\AddressesResponse located in C:/Users/Muhammad Adnan/Downloads/test-upwork-master/spree-retail/app\Http\Resources\Profile\AddressesResponse.php does not comply with psr-4 autoloading standard. Skipping.
Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script
> #php artisan package:discover --ansi
Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 {main}
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
PHP Fatal error: Uncaught Error: Class "Illuminate\Foundation\Application" not found in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php:14
Stack trace:
#0 C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\artisan(20): require_once()
#1 {main}
thrown in C:\Users\Muhammad Adnan\Downloads\test-upwork-master\spree-retail\bootstrap\app.php on line 14
Script #php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
Unfortunately, older versions of Laravel doesn't not support newer versions of PHP. Laravel 6 is the minimal version for PHP 8.0 support (and it is already pretty old from a web development perspective).
Of course, this is for a fresh installation, you might have code in your project that is also not PHP 8.0 compatible.
About this error:
Problem 1
- jeremy-dunn/php-fedex-api-wrapper is locked to version 5.0.1 and an update of this package was not requested.
- jeremy-dunn/php-fedex-api-wrapper 5.0.1 requires ext-soap * -> it is missing from your system. Install or enable PHP's soap extension.
The problem will be easy to fix, just install the soap extension. You seem on Windows so it should already installed but disabled.
You will have to uncomment ;extension=soap.dll in your php.ini file (or maybe in the ext directory located in your php directory, it depends).
There will probably be other extensions required but disabled, to get a full list execute composer check.
This is what is preventing composer from installing your dependencies (which lead Uncaught Error: Class "Illuminate\Foundation\Application" not found in to when you are calling composer dump-autoload).
I searched out and found a solution regarding this issue. Only single command is the solution
Note: Don't update composer.
composer install --ignore-platform-reqs
After a lot of effort I finally managed to get my composer (with drush) working with Drupal 8.5.3
However I would like to update Drupal to latest version with composer.
Updating composer with sudo doesnt gives me errors but doesnt update my Drupal.
I used this command from my project dir;
sudo composer update drush/drush --with-dependencies
I read that it's bad practice to use sudo for composer and because it doesnt update my Drupal
I try using composer update without sudo.
First I got some warnings that cache could not be used. Because they're only warnings I ignored them.
After some time it sees 11 updates and right after that I got a big red errormessage;
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 11 updates, 0 removals
[RuntimeException]
/path-to-my-site/drupal-composer-build/vendor/symfony/polyfill-ctype does not exist and could not be created.
I then tried the sollution in RuntimeException] vendor does not exist and could not be created
So I did;
Add your user in the www-data group (this action require you to logout and login again)
sudo usermod -a -G www-data `whoami`
Give these permissions to your project
sudo chown -R www-data:www-data /var/www/<project>
sudo chmod -R 774 /var/www/<project>
I skipped the 2nd part that gives rights to /var/www because I'm on a shared server without root userrights.
I got the following message;
No composer.json in current directory, do you want to use the one at /path-to-site? [Y,n]? y
after that got some cache warnings again and the following question;
Cannot create cache directory /home/maikel/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/maikel/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/maikel/.composer/cache/repo/https---repo.packagist.org/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 6 updates, 0 removals
- Updating symfony/event-dispatcher (v3.4.14 => v3.4.15):
Update failed (Could not delete /path-to-site/vendor/symfony/event-dispatcher/GenericEvent.php: )
Would you like to try reinstalling the package instead [yes]? y
I anwered yes again, then;
- Removing symfony/event-dispatcher (v3.4.14)
[RuntimeException]
Could not delete /path-to-site/vendor/symfony/event-dispatcher/GenericEvent.php:
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev]
[--lock] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-
progress] [--no-suggest] [--with-dependencies] [--with-all-dependencies]
[-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-
authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--prefer-
stable] [--prefer-lowest] [-i|--interactive] [--root-reqs] [--]
[<packages>]...
My two questions are;
Do I really really need composer (with drush)? I rather drop composer
or Drupal alltogether
If I really need it to properly manage updates in the future, how can
I configure composer to update, do I need a global configuration?
Thanks a lot in advance
If I can update this question with more information/config files please let me know, I'll gladly do, I honestly don't know where to begin.
I have been struggling with this now for 2 days and cannot get past trying to enable the address module as I just get the error message "Address requires the commerceguys/addressing library."
Documentation seems a bit unclear how to enable this, and even the documentation page returns a 404 error. I have followed the README.me file in the address module but still just getting the same error.
My Steps:
1.) Download Address module, unzip and add to /modules
2.) Enable in the D8 extend page, message returned "Address requires the commerceguys/addressing library"
I then download and unzip the library from the git page https://github.com/commerceguys/addressing, this unzips a directory called addressing-master
Now I'm not sure where I should put this folder. do I make a '/libraries' folder and put it in there? Do I put it in '/vendor'?
I tried both the above and re attempted to enable the address module but still got the same message returned "Address requires the commerceguys/addressing library."
So I have installed composer manager, run init.php from the command line, all good, went to enable the address module and still got that same message.
I then try cd into the address module directory in terminal then run $ composer install, still got that same message.
Now I try adding "commerceguys/addressing": "dev-master" to the require part of the composer.json file that's in the root directory then running composer drupal-update from the root of my project and I get this:
Drupal\composer_manager\Composer\Command::update
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Updating jcalderonzumba/mink-phantomjs-driver dev-master (10d7c48 => 5bf53fa)
[RuntimeException]
The .git directory is missing from /Users/barrypoore/mampsites/d8/vendor/jcalderonzumba/mink-phantomjs-driver, see https://getcomposer.org/commit-deps for m
ore information
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--] [
]...
I have googled as much as I can to try to resolve this but 2 days now and I'm still stuck with no address module enabled, can somebody please advise?
Thanks you in advance.
At least part of your problem is a Drupal core issue with the jcalderonzumba/mink-phantomjs-driver package that they've fixed in 8.0.x-dev:
https://www.drupal.org/node/2629772
I couldn't get their patch to apply cleanly but when I manually made the changes, I was able to run drupal-update and install the Address module.
I'm use composer update in a Yii2 project, but it is exiting with an exception.
I have updated composer to the lastest version, c6cc6dd6070871f4b198ed39f76dd8047c116b02, but it still doesn't work:
Importing tag v2.0.2 (2.0.2.0)
Reading bower.json of bower-asset/yii2-pjax (v2.0.1)
Reading /home/xiaoai/.composer/cache/repo/github.com/yiisoft/jquery-pjax/bower-f07ce95f6098c0bd5421789a20789f39a19be73b from cache
Importing tag v2.0.1 (2.0.1.0)
Reading /home/xiaoai/.composer/cache/repo/https---packagist.org/provider-yiisoft$yii2-bootstrap.json from cache
Reading /home/xiaoai/.composer/cache/repo/https---packagist.org/provider-bower-asset$bootstrap.json from cache
Downloading https://bower.herokuapp.com/packages/bootstrap
Writing /home/xiaoai/.composer/cache/repo/https---bower.herokuapp.com-packages/bootstrap-3c71cc99d2fc1c12a3d3e1b27e448ca612a89a1d-package.json into cache
Adding VCS repository bower-asset/bootstrap
Downloading https://api.github.com/repos/twbs/bootstrap
Downloading https://api.github.com/repos/twbs/bootstrap/contents/bower.json?ref=master
Downloading https://api.github.com/repos/twbs/bootstrap/commits/master
Downloading https://api.github.com/repos/twbs/bootstrap/tags?per_page=100
Downloading https://api.github.com/repos/twbs/bootstrap/git/refs/heads?per_page=100
[UnexpectedValueException]
Could not parse version constraint <=2.*: Invalid version string "2.*"
Exception trace:
() at phar:///usr/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:461
Composer\Package\Version\VersionParser->parseConstraint() at phar:///usr/bin/composer.phar/src/Composer/Package/Version/VersionParser.php:257
Composer\Package\Version\VersionParser->parseConstraints() at phar:///usr/bin/composer.phar/src/Composer/Package/Loader/ArrayLoader.php:234
Composer\Package\Loader\ArrayLoader->parseLinks() at phar:///usr/bin/composer.phar/src/Composer/Package/Loader/ArrayLoader.php:123
Composer\Package\Loader\ArrayLoader->load() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:174
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->preInitBranchPackage() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:138
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initBranches() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AssetVcsRepository.php:45
Fxp\Composer\AssetPlugin\Repository\AssetVcsRepository->initialize() at phar:///usr/bin/composer.phar/src/Composer/Repository/ArrayRepository.php:178
Composer\Repository\ArrayRepository->getPackages() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:104
Composer\DependencyResolver\Pool->addRepository() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:60
Fxp\Composer\AssetPlugin\Repository\Util::addRepositoryInstance() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/Util.php:39
Fxp\Composer\AssetPlugin\Repository\Util::addRepository() at /home/xiaoai/.composer/vendor/fxp/composer-asset-plugin/Repository/AbstractAssetsRepository.php:139
Fxp\Composer\AssetPlugin\Repository\AbstractAssetsRepository->whatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:199
Composer\DependencyResolver\Pool->computeWhatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Pool.php:188
Composer\DependencyResolver\Pool->whatProvides() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:161
Composer\DependencyResolver\RuleSetGenerator->whitelistFromPackage() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:273
Composer\DependencyResolver\RuleSetGenerator->whitelistFromJobs() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/RuleSetGenerator.php:324
Composer\DependencyResolver\RuleSetGenerator->getRulesFor() at phar:///usr/bin/composer.phar/src/Composer/DependencyResolver/Solver.php:177
Composer\DependencyResolver\Solver->solve() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:505
Composer\Installer->doInstall() at phar:///usr/bin/composer.phar/src/Composer/Installer.php:230
Composer\Installer->run() at phar:///usr/bin/composer.phar/src/Composer/Command/UpdateCommand.php:140
I don't think this is my mistake, but how do I fix the exception?
Michael Nguyen's answer did not work for me, but updating to dev-master did:
php composer.phar global require "fxp/composer-asset-plugin:dev-master"
One may also need to update composer itself:
php composer.phar self-update
Also there was an extensive discussion on this yesterday: link.
UPDATE. It seems to me at this moment "fxp/composer-asset-plugin:1.0.*#dev" is better again.
I have the same issue and discussed on Yii Forum. It seems like this is a bug with "fxp/composer-asset-plugin".
Try
php composer.phar global require "fxp/composer-asset-plugin:1.0.1"
Then do whatever you need with composer
The bug is discussed at https://github.com/francoispluchino/composer-asset-plugin/issues/129
It helped for me
composer self-update
composer global update