Welcome Guest, Not a member yet? Register   Sign In
Model files in CI4
#21

In other words:
in Ci3 documentation there was a chapter "General Topics/Creating Libraries"; where is it in Ci4? Disappeared!
Now, after months wasted, I think that, instead of CI Libraries, I have to make normal php files of functions, maybe using namespaces.
Ok, it's very easy: dedicated CI functions are not required for this. But it should be written someware in the Ci4 documentation!
Reply
#22

Here is an example CI 4 library, just make sure the namespace points to the folder where you place it.
PHP Code:
<?php

namespace App\Libraries;

/**
 * Class ExampleName
 *
 * @package App\Libraries
 */
class ExampleName
{
    /**
    * Class properties go here.
    * -------------------------------------------------------------------
    * public, private, protected, static and const.
    */


    /**
    * __construct ()
    * -------------------------------------------------------------------
    *
    * Class    Constructor
    *
    * NOTE: Not needed if not setting values or extending a Class.
    *
    */
    public function __construct()
    {

    }

}
  // End of ExampleName Library Class.

/**
 * -----------------------------------------------------------------------
 * Filename: ExampleName.php
 * Location: ./app/Libraries/ExampleName.php
 * -----------------------------------------------------------------------
 */ 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB