PHP code example of dlunire / dlcore

1. Go to this page and download the library: Download dlunire/dlcore 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/ */

    

dlunire / dlcore example snippets



namespace App\Models;

use DLCore\Database\Model;

class Products extends Model {}

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

class Products extends Model {
    protected static ?string $table = "SELECT * FROM products WHERE active = 1";
}


use DLCore\Core\BaseController;

final class TestController extends BaseController {
  public function products(): array {
    $register = Products::get();
    $count = Products::count();
    $page = 1;
    $paginate = Products::paginate($page, 50);

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


final class TestController extends BaseController {
  public function create_product(): array {
    $created = Products::create([
      "product_name" => $this->get_Product created successfully."
    ];
  }
}


use DLCore\Core\BaseController;
use DLCore\Mail\SendMail;

final class TestController extends BaseController {
  public function mail(): array {
    $email = new SendMail();
    return $email->send(
      $this->get_email('email_field'),
      $this->get_


use DLCore\Auth\DLAuth;
use DLCore\Auth\DLUser;

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

    $this->set_username(
      $this->get_
    ]);
  }
}