php rapid development framework
app
├ cache
├ config
├ controllers
├ models
└ views
//With annotations
namespace controllers;
class Main extends ControllerBase{
/**
* @route("index","methods"=>["get","post"])
*/
public function index(){
//
}
}
//With php native attributes
namespace controllers;
use Ubiquity\attributes\items\router\Route;
class Main extends ControllerBase{
#[Route('index', methods: ['get','post'])]
public function index(){
//
}
}
//With annotations
namespace models;
class Product{
/**
* @id
* @column("name"=>"id","dbType"=>"int(11)")
*/
private $id;
/**
* @column("name"=>"name","dbType"=>"varchar(65)")
*/
private $name;
}
//With php native attributes
namespace models;
use Ubiquity\attributes\items\Id;
use Ubiquity\attributes\items\Column;
class Product{
#[Id()]
#[Column(name: 'id', dbType: 'int(11)')]
private $id;
#[Column(name: 'name', dbType: 'varchar(65)')]
private $name;
}
$products=DAO::getAll("models\Product");
$product=new Product();
$product->setName("Brocolis");
$products=DAO::save($product);
class Products extends ControllerBase{
public function index(){
$this->loadView("index.html",["message"=>"Hello"]);
}
{% extends "base.html" %}
{% block body %}
{{ message }}
{% endblock %}
}
namespace controllers;
class Product{
}
app
└ controllers
└ Product.php
class IndexController extends ControllerBase{
...
public function isValid($action){
return USession::exists('activeUser');
}
public function onInvalidControl(){
$this->initialize();
$this->loadView("unauthorized.html");
$this->finalize();
}
}