PHP code example of eliasdevel / coffee-framework

1. Go to this page and download the library: Download eliasdevel/coffee-framework library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eliasdevel / coffee-framework example snippets



use core\Routes as Routes;
use core\Loader as Loader;
$routes = new Routes();

//Set Your Routes Here
$routes->setRoute('elias/aaa','Elias','aaa',2);

//Example default route for index call of Elias Controller
$routes->setRoute('elias','Elias');

new Loader($routes->getRoutes(),$routes->getAccess());




namespace Controllers;

use core\Controller as Controller;
use core\library\Path as Path;
use core\library\ConfigParser as Config;


class Elias extends Controller
{

    public function index($parm = null)
    {
      //Call to EliasModel in models directory default call the ControllerName+Model.
      //if you use $this->model('Name')->insertTest(); the call is for NameModel
        $this->model()->insertTest();
      
      //Base url function usage
       echo Path::baseUrl();

    }

    public function aaa($a, $b)
    {
        //function call test
        var_dump($a, $b);
    }
}




namespace Models;

use core\Model as Model;

class EliasModel extends Model{
    private $table = 'teste';
    public function insertTest(){
        
        //Database default Parser With PDO Acess
        $this->insert($this->table,['nome'=>'Elias']);
        $this->update($this->table,['nome'=>'Zebu'],2);
        $this->delete($this->table,2);

        var_dump($this->selectWhithoutFilter("Select * from $this->table"));

    }
}