PHP composer autoload not loading class -
PHP composer autoload not loading class -
i'm getting started using composer dependency management , i'm having hard time figuring out how i'm not adhering psr-4 autoloading i'm here advice. i've got class generates random values on packagist. project construction next (i've labeled composer.json files , b):
project dir
|classfile.php |composer.json |vendor |autoload.php |ejfrancis |php-random-value b |composer.json |randomvalue.php <--the class want autoloaded
composer.json a
{ "require": { "ejfrancis/php-random-value": "dev-master" } }
composer.json b
{ "name": "ejfrancis/php-random-value", "description": "secure random value generator.", "require": { "php": ">=5.3.0" }, "license": "mit", "autoload": { "psr-4": { "ejfrancis\\" : "" } } }
and randomvalue.php file, declares ejfrancis namespace
namespace ejfrancis; class randomvalue{ //foo }
when run app error 'class randomvalue not found', it's not autoloading correctly. not complying psr-4, or there else i'm doing wrong? i've tried autoloading using composer classmap "classmap" : ["randomvalue.php"]
no success. help
update: i've run 'composer validate' on composer.json b file, valid
how code creates error mention? see it, missed utilize right namespace there, else looks good.
php composer-php autoload psr-4
Comments
Post a Comment