Welcome Guest, Not a member yet? Register   Sign In
Codeigniter and Composer psr-4
#1

Hi guys
composer.json
Code:
{
 "autoload": {
   "psr-4": {
     "App\\": "application/libraries"
   }
 }
}

application/libraries
PHP Code:
<?php
namespace App\Libraries;

class 
Welcome_library {

 
   public function __construct()
 
   {
 
       echo 'hi';
 
   }


application/controllers
PHP Code:
<?php
defined
('BASEPATH') OR exit('No direct script access allowed');

class 
Welcome extends CI_Controller {

 
   /**
     * Index Page for this controller.
     *
     * Maps to the following URL
     *        http://example.com/index.php/welcome
     *    - or -
     *        http://example.com/index.php/welcome/index
     *    - or -
     * Since this controller is set as the default controller in
     * config/routes.php, it's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see https://codeigniter.com/user_guide/general/urls.html
     */
 
   public function index()
 
   {
 
       new App\Libraries\Welcome_library;
 
       $this->load->view('welcome_message');
 
   }



PHP Code:
Fatal error: Class 'App\Libraries\Welcome_library' not found 

What am I doing wrong.
Thanks
Reply


Messages In This Thread
Codeigniter and Composer psr-4 - by phpforever2017 - 03-14-2017, 10:24 AM
RE: Codeigniter and Composer psr-4 - by Narf - 03-14-2017, 11:11 AM
RE: Codeigniter and Composer psr-4 - by Narf - 03-15-2017, 02:57 AM
RE: Codeigniter and Composer psr-4 - by Narf - 03-16-2017, 03:41 AM
RE: Codeigniter and Composer psr-4 - by llebkered - 03-16-2017, 04:51 AM
RE: Codeigniter and Composer psr-4 - by Narf - 03-16-2017, 05:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB