1. Go to this page and download the library: Download dlunamontilla/dlunire 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/ */
dlunamontilla / dlunire example snippets
use DLRoute\Requests\DLRoute;
DLRoute::get('/', "DLUnire\\Controllers\\TestController@method");
use DLRoute\Requests\DLRoute;
DLRoute::get("/", function() {
return view('vista');
});
use DLRoute\Requests\DLRoute;
DLRoute::get("/user/{id}", [TestController::class, 'method'])
namespace DLUnire\Controllers;
use Framework\Config\Controller;
final class TestController extends Controller {
public function method(object $params): string {
return view('vista', [
"variable1" => "Valor de la variable 1",
"variable2" => "Valor de la variable 2"
]);
}
}
/ruta/{param1}/{param2}{paramN}
# Estos parámetros se convierten a esto de forma automática:
$param->param1;
$param->param2;
$param->paramN;
namespace DLUnire\Controllers;
use Framework\Config\Controller;
final class TestController extends Controller {
public function method(object $param): string {
/*
* Valores de la petición
*
* @var array $values
*/
$values = $this->get_values();
return view('vista');
}
}
namespace DLUnire\Controllers;
use Framework\Config\Controller;
final class TestController extends Controller {
public function method(object $param): string {
/**
* Correo electrónico
*
* @var string|null $email
*/
$email = $this->get_email('email');
/**
* Identificador único universal
*
* @var string |null $uuid
*/
$uuid = $this->get_uuid('uuid');
return view('vista', [
"email" => $email,
"uuid" => $uuid
]);
}
}
namespace DLUnire\Models;
use DLTools\Database\Model;
final class Tabla extends Model {}
namespace DLUnire\Models;
use DLTools\Database\Model;
final class Tabla extends Model {
protected static ?string $table = "otra_tabla";
}
namespace DLUnire\Models;
use DLTools\Database\Model;
class Users extends Model {}
$users = Users::get();
/**
* Número de páginas
*
* @var int $page
*/
$page = 1;
/**
* Registros por página
*
* @var integer $rows
*/
$rows = 100;
$users = Users::paginate($page, $rows);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.