https://github.com/mathsgod/puxt
https://github.com/mathsgod/puxt
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mathsgod/puxt
- Owner: mathsgod
- Created: 2020-12-21T10:07:05.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-02-07T04:50:25.000Z (over 1 year ago)
- Last Synced: 2025-03-13T09:03:24.996Z (over 1 year ago)
- Language: PHP
- Size: 811 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# puxt
## Setup
Create pages folder and add index.php file
```php
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.
```env
DEBUG=true
```
## Exception format
Set the `DEBUG_EXCEPTION_FORMAT` environment variable to `json` to enable exception format.
```env
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`.
```env
BASE_PATH=api
```
## Route strategy
Set the `ROUTE_STRATEGY` environment variable to change the route strategy.
```env
ROUTE_STRATEGY=json
```
### HTML header
It will change the html title to `Custom title`.
```php
use function PUXT\useHead;
//call this function in the get method of the page
useHead([
"title" => "Custom title",
]);
```
### .htaccess
```htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
```