mathsgod/puxt

PHP framework

Maintainers

Details

github.com/mathsgod/puxt

Source

Issues

Installs: 434

Dependents: 4

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:framework

3.1.1 2024-07-05 05:19 UTC

README

Setup

Create pages folder and add index.php file

use Laminas\Diactoros\Response\HtmlResponse;
return new class{
    public function get(){
        return new HtmlResponse("Hello world");
    }
}

It will output Hello world in the browser when reqeust to / path.

Debug

Set the DEBUG environment variable to true to enable debug mode.

DEBUG=true

Exception format

Set the DEBUG_EXCEPTION_FORMAT environment variable to json to enable exception format.

DEBUG_EXCEPTION_FORMAT=json

Base path of uri

Set the BASE_PATH environment variable to change the base path. For example, set BASE_PATH to api will change the base path to /api.

BASE_PATH=api

Route strategy

Set the ROUTE_STRATEGY environment variable to change the route strategy.

ROUTE_STRATEGY=json

HTML header

It will change the html title to Custom title.

use function PUXT\useHead;

//call this function in the get method of the page
useHead([
    "title" => "Custom title",
]);

.htaccess

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php [L]