php - Composer autoload psr-0 doesn't find class -


this project structure

api  |  picoapi     |      managers              |               apimanager.php      composer.json       index.php 

this how composer looks like:

{     "autoload": {         "psr-0": {             "picoapi\\": "",             "picoapi\\managers\\" : "managers"         }     } } 

this index.php:

//require pico api autoload require 'vendor/autoload.php';  use picoapi\managers\apimanager;  try {     //initialize api     apiinitializer::initialize();      //initialize new api request     $api = new apimanager($_request['request']);     echo utf8_encode($api->processapi());  } catch (exception $e) {     echo json_encode(array(error::jsonerrorfield() => $e->getmessage())); } 

in apimanager.php included: namespace picoapi\managers;

and yet error doesn't find apimanager.php.

when changing composer psr-4 work, want psr-0.

what doing wrong ?

you using notation psr-4, need use psr-4. psr-0 not allow intercessory path between portions of class name. if want use need move src/managers/apimanager.php in src/picoapi/managers/apimanager.php

"psr-0": {     "picoapi\\": "src" } 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -