Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thiagofleal/tonight-php
PHP Tonight framework
https://github.com/thiagofleal/tonight-php
Last synced: about 1 month ago
JSON representation
PHP Tonight framework
- Host: GitHub
- URL: https://github.com/thiagofleal/tonight-php
- Owner: thiagofleal
- License: mit
- Created: 2019-10-16T14:31:47.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-23T01:27:08.000Z (over 1 year ago)
- Last Synced: 2024-03-29T08:03:47.836Z (9 months ago)
- Language: PHP
- Size: 111 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Tonight framework
Tonight-PHP is a PHP mini-framework made to easily develop SQL Database connections, MVC structures and many other tools.## Use
To use Tonight-PHP, just install via Composer:
```shell
composer require thiagofleal/tonight-php
```### Examples
##### Database connection
```PHP
tbl_test object) */
$database->load("tbl_test");/* Insert row */
$database->tbl_test->insert([
'cl_test1' => "First field",
'cl_test2' => "Second field",
'cl_test3' => "Third field"
]);
$database->tbl_test->commit();/* Get all as Table */
$all = $database->tbl_test;/* Get all as array */
$array = $database->tbl_test->get();/* Select rows */
$selected = $database->tbl_test->where('id', SQL::EQUAL, 10)->toArrayList();/* Update row */
$update = $selected->first();
$update->cl_test1 = "Field 1";
$database->tbl_test->setValue($update);
$database->tbl_test->commit();/* Delete row */
$database->tbl_test->deleteWhere('id', SQL::EQUAL, 5);
$database->tbl_test->commit();
```#### MVC
##### Config
```PHP
setVariable("title", "Example");
$this->render("page", "template");
}
public function example($request, $args) {
$this->setVariable("value", $args->value);
$this->render("example", "template");
}
}
```