PHP Fatal Error – yii\base\ErrorException Class 'Da\QrCode\QrCode'
not found
code fires the Err in my TaolistController.php
use Da\QrCode\QrCode;
public function actionGenQrcode(){
$qrCode = (new QrCode($kaSTR))//right here
->setSize(250)
->setMargin(5)
->useForegroundColor(51, 153, 255);
}
I've used composer to add 2amigos.
C:\Users\cyh>composer require 2amigos/qrcode-library:~1.1
./composer.json has been created Loading composer repositories with
package information Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
- Installing khanamiryan/qrcode-detector-decoder (1): Downloading (100%)
- Installing bacon/bacon-qr-code (1.0.3): Downloading (100%)
- Installing 2amigos/qrcode-library (1.1.2): Downloading (100%) Writing lock file Generating autoload files
Actually my phpstorm can find this class. I'm using yiiframework.
run the following command using terminal(CMD)
composer dump-autoload
this command will dumps the autoloaded files
if this not working try to use it like Component
http://qrcode-library.readthedocs.io/en/latest/yii/qrcode-component/
Try install QR Code library using
composer require 2amigos/qrcode-library
It works for me. Good luck.
Related
I'm trying to install the package maddhatter/laravel-fullcalendar (Laravel helper for FullCalendar.io) with composer.
So here is the command I run:
'''
php ../../composer.phar require maddhatter/laravel-fullcalendar
'''
And here is the result:
Using version ^1.3 for maddhatter/laravel-fullcalendar
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Installing maddhatter/laravel-fullcalendar (v1.3.0): Downloading (100%)
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Writing lock file
Generating autoload files
php artisan clear-compiled
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Foundation\Application::getCachedCompilePath()
Script php artisan clear-compiled handling the post-update-cmd event returned with error code 255
But now I wonder if the package is installed or not, because it now appears in my list of installed packages.
If anyone has the answer, thanks in advance.
Try to delete file compiled.php in your vendor directory manually, and then it started to work again.
I face this case when I want to download any package in laravel
However, the package is downloaded
but I don't Know if it will cause a problem in the future.
C:\xampp\htdocs\final2>composer require "laravelcollective/html":"^5.4.0"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
The 'http://repo.packagist.org/p/fideloper/proxy%24de6ed8cb77cc53bdea76e3b52aa1
7a7e3cb93f816873ede7f13eba172a9059d.json' URL could not be accessed: HTTP/1.1 4
0 Bad URI
http://repo.packagist.org could not be fully loaded, package information was lo
ded from the local cache and may be out of date
Package operations: 1 install, 0 updates, 0 removals
- Installing laravelcollective/html (v5.5.4): Downloading (100%)
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. N
replacement was suggested.
Writing lock file
Generating optimized autoload files
When I install a Symfony 4 skeleton project and add the JmsSerializerBundle, I get an error.
To reproduce:
composer create-project symfony/website-skeleton myproject
cd myproject
composer require jms/serializer-bundle
The installation ends with an error:
Using version ^3.0 for jms/serializer-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.1.*"
Package operations: 16 installs, 0 updates, 0 removals
- Installing hoa/exception (1.17.01.16): Loading from cache
- Installing hoa/event (1.17.01.13): Loading from cache
- Installing hoa/consistency (1.17.05.02): Loading from cache
- Installing hoa/visitor (2.17.01.16): Loading from cache
- Installing hoa/ustring (4.17.01.16): Loading from cache
- Installing hoa/protocol (1.17.01.14): Loading from cache
- Installing hoa/zformat (1.17.01.10): Loading from cache
- Installing hoa/iterator (2.17.01.10): Loading from cache
- Installing hoa/compiler (3.17.08.08): Loading from cache
- Installing hoa/regex (1.17.01.13): Loading from cache
- Installing hoa/math (1.17.05.16): Loading from cache
- Installing hoa/stream (1.17.02.21): Loading from cache
- Installing hoa/file (1.17.07.11): Loading from cache
- Installing jms/metadata (2.0.0): Loading from cache
- Installing jms/serializer (2.0.0): Loading from cache
- Installing jms/serializer-bundle (3.0.0): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 1 recipe (f702450e5b1b913f83ea887faacbdb83)
- WARNING jms/serializer-bundle (>=2.0): From github.com/symfony/recipes-contrib:master
The recipe for this package comes from the "contrib" repository, which is open to community contributions.
Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/jms/serializer-bundle/2.0
Do you want to execute this recipe?
[y] Yes
[n] No
[a] Yes for all packages, only for the current installation session
[p] Yes permanently, never ask again for this project
(defaults to n): y
- Configuring jms/serializer-bundle (>=2.0): From github.com/symfony/recipes-contrib:master
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ArrayNode.php line 304:
!!
!! Unrecognized option "xml" under "jms_serializer.visitors"
Running composer etc on Windows 10 Powershell. I'm guessing the skeleton is too bare and it needs a dependency, but shouldn't that be solved automatically?
What could be the cause? How can I fix it? Thanks in advance for your help.
The current recipe is not compatible with JMSSerializerBundle 3 (there is a pending pull request, see https://github.com/symfony/recipes-contrib/pull/559). So for now, you need to adapt the configuration manually.
I'm running PHP 7 on Mac High Sierra with Apache . How do I install a library so that it is universally available for all my PHP scripts? I have this line in my test.php file
$loop = React\EventLoop\Factory::create();
$tcp = new \React\SocketClient\TcpConnector($loop);
The source code (from ReactPHP -- https://github.com/Bit-Wasp/stratum-php) in question is in a separate project in the directory
./vendor/react/event-loop/src/Factory.php
I copied the "Factory.php" file to the same directory as my "test.php" file but I still get the error
Fatal error: Uncaught Error: Class 'React\EventLoop\Factory' not found in /Library/WebServer/Documents/stratum/test.php on line 9
Where can I install the missing file to so that it can be universally picked up by all scripts?
Edit: I had tried installing the library using composer. Below is the output. I don't know where it is installing things but it's not getting picked up by my code ...
localhost:react-master davea$ composer global require react/event-loop react/http
Changed current directory to /Users/davea/.composer
Using version ^0.4.3 for react/event-loop
Using version ^0.8.1 for react/http
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 12 installs, 0 updates, 0 removals
- Installing react/promise (v2.5.1): Loading from cache
- Installing evenement/evenement (v3.0.1): Downloading (100%)
- Installing react/event-loop (v0.4.3): Loading from cache
- Installing react/stream (v0.7.7): Loading from cache
- Installing react/promise-stream (v1.1.1): Loading from cache
- Installing react/promise-timer (v1.2.1): Loading from cache
- Installing react/socket (v0.8.9): Loading from cache
- Installing react/dns (v0.4.12): Loading from cache
- Installing react/cache (v0.4.2): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing ringcentral/psr7 (1.2.2): Loading from cache
- Installing react/http (v0.8.1): Loading from cache
react/event-loop suggests installing ext-libevent (>=0.1.0)
react/event-loop suggests installing ext-event (~1.0)
react/event-loop suggests installing ext-libev (*)
Writing lock file
Generating autoload files
I know there are many subject about composer but I won't be able to install phpword through composer.
Basically I need to install PHPWord to create word on my network server.
I install wamp on my computer, install composer and create a new folder on www.
Let's say the main directory is : www/test/
I write a composer.json file :
{
"require": {
"phpoffice/phpword": "v0.13.*"
}
}
And with command line, I tried composer install :
Failed loading c:/wamp/bin/php/php5.6.19/ext/php_xdebug-2.4.0-5.6-vc11-nts.dll
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 6 installs, 0 updates, 0 removals
- Installing pclzip/pclzip (2.8.2): Loading from cache
- Installing phpoffice/common (v0.2.6): Loading from cache
- Installing zendframework/zend-stdlib (2.4.13): Loading from cache
- Installing zendframework/zend-validator (2.4.13): Loading from cache
- Installing zendframework/zend-escaper (2.4.13): Loading from cache
- Installing phpoffice/phpword (v0.13.0): Loading from cache
zendframework/zend-stdlib suggests installing zendframework/zend-eventmanager (To support aggregate hydrator usage)
zendframework/zend-stdlib suggests installing zendframework/zend-serializer (Zend\Serializer component)
zendframework/zend-stdlib suggests installing zendframework/zend-servicemanager (To support hydrator plugin manager usage)
zendframework/zend-stdlib suggests installing zendframework/zend-filter (To support naming strategy hydrator usage)
zendframework/zend-validator suggests installing zendframework/zend-db (Zend\Db component)
zendframework/zend-validator suggests installing zendframework/zend-filter (Zend\Filter component, required by the Digits validator)
zendframework/zend-validator suggests installing zendframework/zend-i18n (Zend\I18n component to allow translation of validation error messages as well as to use the various Date validators)
zendframework/zend-validator suggests installing zendframework/zend-math (Zend\Math component)
zendframework/zend-validator suggests installing zendframework/zend-resources (Translations of validator messages)
zendframework/zend-validator suggests installing zendframework/zend-servicemanager (Zend\ServiceManager component to allow using the ValidatorPluginManager and validator chains)
zendframework/zend-validator suggests installing zendframework/zend-session (Zend\Session component)
zendframework/zend-validator suggests installing zendframework/zend-uri (Zend\Uri component, required by the Uri and Sitemap\Loc validators)
phpoffice/phpword suggests installing ext-gd2 (Allows adding images)
phpoffice/phpword suggests installing dompdf/dompdf (Allows writing PDF)
Writing lock file
Generating autoload files
So now I've got a new folder call vendor with autoload.php and many folder inside (zendframework, phpoffice...)
When I try to go to a phpword example, I've got this error :
Fatal error: Uncaught exception 'Exception' with message 'Could not find file '/autoload.php'. It is generated by Composer. Use 'install --prefer-source' or 'update --prefer-source' Composer commands to move forward.' in C:\wamp\www\Nouveau dossier (2)\vendor\phpoffice\phpword\bootstrap.php on line 22
( ! ) Exception: Could not find file '/autoload.php'. It is generated by Composer. Use 'install --prefer-source' or 'update --prefer-source' Composer commands to move forward. in C:\wamp\www\Nouveau dossier (2)\vendor\phpoffice\phpword\bootstrap.php on line 22
The path to autoload.php seems ok.
Anyone know why there is this problem ?
After I juste need to copy vendor folder to my network server ? (windows server with wamp)
Thank for your help.