You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dev@laravel:~/apps/testapp$ composer require duzun/hquery
Using version ^1.5 for duzun/hquery
./composer.json has been updated
Warning: You should avoid overwriting already defined auth settings for github.com.
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing duzun/hquery (1.5.0)
Downloading: 100%
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
dev@laravel:~/apps/testapp$ php artisan runcommand
[ErrorException]
Cannot redeclare class duzun\hQuery
runcommand contents:
use duzun\hQuery;
hQuery::$cache_path = '/home/dev/apps/testapp/storage/cache';
I've commented line //class_alias('hQuery', 'duzun\\hQuery'); in psr-4\hQuery.php and that solved the issue, but I'm not sure is that ok or not :)
The text was updated successfully, but these errors were encountered:
Thanks for taking time to report the issue @dragonattack !
You are not the first person to face this issue, but I never had the chance to test in Laravel (I guess it is v5, right?).
For the sake of PHP <= 5.2 I'm not using namespaces in main hquery.php file.
But I'm emulating them with psr-4 for guys that use PHP >= 5.3.
Basically it is enough to include hquery.php file in your project and start using hQuery class.
I guess Laravel also emulates psr-4 for the classmap key of composer.json and when it gets to /psr-4/hQuery.php, the duzun\\hQuery class has already been defined.
Could you try to replace the commented line with the following:
class_exists('duzun\\hQuery', false) or class_alias('hQuery', 'duzun\\hQuery');
I'm installing hQuery in laravel with composer:
runcommand contents:
I've commented line
//class_alias('hQuery', 'duzun\\hQuery');
inpsr-4\hQuery.php
and that solved the issue, but I'm not sure is that ok or not :)The text was updated successfully, but these errors were encountered: