PHP code example of dlunamontilla / dltools

1. Go to this page and download the library: Download dlunamontilla/dltools 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 / dltools example snippets




namespace TuApp\Models;

use DLTools\Database\Model;

class Products extends Model {}


class Products extends Model {
  protected static ?string $table = "otra_tabla";
}


class Products extends Model {
  protected static ?string $table = "SELECT * FROM tabla WHERE record_status = :record_status";
}


use DLTools\Core\BaseController;

final class TestController extends BaseController {

  /**
   * Ejemplo de interacción con el modelo `Products`.
   * 
   * @return array
   */
  public function products(): array {
    /**
     * Devuelve, máximo 100 registros
     * 
     * @var array $register
     */
    $register = Products::get();

    /**
     * Devuelve un número total de registros almacenados en la tabla
     * `products`.
     * 
     * @var integer $count
     */
    $count = Products::count();

    /**
     * Número de páginas
     * 
     * @var integer
     */
    $page = 1;

    /**
     * Número de registros por página.
     * 
     * @var integer
     */
    $paginate = Products::paginate($page, 50);

    return [
      "count" => $count,
      "register" => $register,
      "paginate" => $paginate
    ];
  }
}



use DLTools\Core\BaseController;

final class TestController extends BaseController {

  public function products(): array {
    $created = Products::create([
      "product_name" => $this->get_
    ];
  }
}


use DLTools\Core\BaseController;

final class TestController extends BaseController {

  /**
   * Ejemplo de envío de correos electrónicos.
   * 
   * @return array
   */
  public function mail(): array {
    $email = new SendMail();

    return $email->send(
      $this->get_email('email_field'),
      $this->get_


use DLTools\Auth\DLAuth;
use DLTools\Auth\DLUser;

class Users extends DLUser {
  public function capture_credentials(): void {
    $auth = DLAuth::get_instance();

    $this->set_username(
      $this->get_n'
    ]);
  }
}
scss
    <pre>@json($array, 'pretty')</pre>
   
scss
    <div class="container">
      @markdown('archivo-markdown')
    </div>