php - Custom Class not found weird error in Laravel 4 using PSR-4 Autoloading -


in custom class.

<?php   namespace customhelpers\api;  class api {    public function __construct()   {   }    public function api_login($data =[])   {      $respond = $this->api_function('admin_login', $data);   }    public function api_function($name, $request, $data = [])   {     $url = $name;   } } 

file structure:

-app --customhelpers ---api ----api.php 

composer.json

 "autoload": {     "classmap": [         "app/commands",         "app/controllers",         "app/models",         "app/database/migrations",         "app/database/seeds",         "app/tests/testcase.php"     ],     "psr-4": {       "customhelpers\\": "app/customhelpers"     }  }, 

class 'customhelpers\api\app' not found

i've done in manual error shown weird because don't have app inside api folder. use command of composer dump-autoload hope can me.

update

use customhelpers\api;   public function login()  {    $new = new customhelpers\api\api();    $session = $new->api_login(array('token'=>$token));  } 

i managed myself.

class 'customhelpers\api\app' not found

this error here finds class of app or facade of app inside customer helper class.

<?php namespace customhelpers\api; use illuminate\support\facades\app; //i add line , solve problem  class api {      public function __construct() {     }    public function api_login($data =[])   {     $respond = $this->api_function('admin_login', $data);   }    public function api_function($name, $request, $data = [])   {      $url = $name;    } } 

Comments