The ulole-framework is a highly customizable PHP-Framework.
# With UPPM
uppm create myapp interaapps/ulole-framework
# Or with Composer
composer create-project interaapps/ulole-framework myapp
<?php
namespace com\example\myproject;
use com\example\myproject\model\User;
use de\interaapps\ulole\orm\UloleORM;
use de\interaapps\ulole\core\Environment;
use de\interaapps\ulole\core\WebApplication;
use de\interaapps\ulole\core\traits\Singleton;
class App extends WebApplication {
use Singleton;
public static function main(Environment $environment){
self::setInstance( (new self())->start($environment) );
}
public function init() : void {
$this->getConfig()
->loadENVFile(".env");
// A ulole-framework helper for UloleORM::database("main", new Database(...))
$this->initDatabase(/*Config prefix*/ "database", "main");
UloleORM::register(User::class);
}
public function run() : void {
$this->getRouter()
->get("/user/{i+:userId}", function($req, $res, int $userId){
$res->json([
"user" => User::table()->where("id", $userId)->get()
]);
});
}
}
php cli serve
A simple serve command (Runs on localhost:8000)
$ php cli repl
>>> ["Hello"=>"World", "Yep" => 1337.1945, "Wait, what?" => null, "Am I allowed to eat chicken?" => true, "Am I allowed to eat wasps?" => false, "Show me what I am allowed to" => [ "Doing nothing", true, false, null, 31423 ], "give me user" => \app\model\User::table()->get() ]
...
>>> echo "Hello world :)"
Multiline works with a \
$ php cli repl
>>> function test(){\
... echo "Hello world :)";\
... }
null
>>> test()
Hello world :)
We will also check for a [
, (
, {
, ,
>>> [
... "adsfasfd"=>31412341234,
... "asfdasfd"=>"asfasdfasd"\
... ]
[
"adsfasfd": 31412341234
"asfdasfd": "asfasdfasd"
]
There is a helpful tool for creating models and other stuff.
$ php cli create:model Test
$ php cli migrate:up
Migrated resources\migrations\migration_220511_000000_create_users
$ php cli migrate:down (how many versions down, optionak)
Downgraded resources\migrations\migration_220511_000000_create_users
$ php cli migrate:status
model | migrated | version
migration_201122_001143_create_user | YES | 1
This is a tool to just walk around the database and create some sql-queries.
// composer require jenssegers\blade
use Jenssegers\Blade\Blade;
$blade = new Blade("resources/views", "cache/views");
function view($view, $vars=[]) {
global $blade;
return $blade->render($view, $vars);
}