Welcome Guest, Not a member yet? Register   Sign In
Autoload my own library
#1

Hi, I made a custom library and is stored inside app/Libraries and the name is Mssql.php
it starts like this
PHP Code:
<?php 
namespace App\Libraries;
class 
Mssql
{
    /* default values */

    private $connection  null;
    private $server "";
    private $database "";
    private $user "";
    private $password "";
    private $port "";

    const ICONV_TRANSLIT "TRANSLIT";
    const ICONV_IGNORE "IGNORE";
    const WITHOUT_ICONV "";

    public function __construct()
    {
        die("Just entered in lib Mssql");
        /*$db = new Database();
        $this->server = $db->mssqlServer;
        $this->database = $db->mssqlDatabase;
        $this->user = $db->mssqlUser;
        $this->password = $db->mssqlPassword;
        $this->port = $db->mssqlPort;*/
    
I try to autoload it, but it is not working because I should see "Just entered in lib Mssql" when entering in the app
My autoload.php is like this
PHP Code:
    public $psr4 = [
        APP_NAMESPACE => APPPATH// For custom app namespace
        'Config'      => APPPATH 'Config',
        'Libraries'  => APPPATH 'Libraries',
    ];

    /**
    * -------------------------------------------------------------------
    * Class Map
    * -------------------------------------------------------------------
    * The class map provides a map of class names and their exact
    * location on the drive. Classes loaded in this manner will have
    * slightly faster performance because they will not have to be
    * searched for within one or more directories as they would if they
    * were being autoloaded through a namespace.
    *
    * Prototype:
    *  $classmap = [
    *      'MyClass'  => '/path/to/class/file.php'
    *  ];
    *
    * @var array<string, string>
    */
    public $classmap = [
        'Mssql' => APPPATH 'Libraries/Mssql.php',
    ]; 


What am I missing?
Thanks!
Reply


Messages In This Thread
Autoload my own library - by jcarvalho - 04-06-2023, 04:22 AM
RE: Autoload my own library - by iRedds - 04-06-2023, 08:53 PM
RE: Autoload my own library - by InsiteFX - 04-06-2023, 10:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB