deawx/restapicore

Cyberthai REST API Core Fast PHP Framework

1.0.0 2025-09-12 02:46 UTC

This package is auto-updated.

Last update: 2025-09-12 03:46:16 UTC


README

# restapicore
Cyberthai REST API Core Fast PHP Framework

## Installation
```bash
composer require deawx/restapicore

Configuration

Create a .env file:

APP_ENV=development
ROUTE_CACHE_PATH=storage/cache/routes.php
CORS_ALLOWED_ORIGINS=http://localhost,https://cyberthai.net
ALLOWED_REDIRECT_HOSTS=localhost,cyberthai.net
SESSION_TIMEOUT=1800
CSRF_EXPIRY=3600
DB_TYPE=mysql
DB_HOST=localhost
DB_NAME=yourapp
DB_USER=root
DB_PASSWORD=secret
DB_PORT=3306
DB_CHARSET=utf8mb4
DB_PERSISTENT=false
CIPHER_ALGO=AES-256-CBC
HMAC_ALGO=sha256
ENCRYPTION_KEY=0123456789abcdef0123456789abcdef
RATE_LIMIT=100
RATE_WINDOW=3600

Ensure the cache directory is writable:

mkdir -p storage/cache
chmod 0755 storage/cache

Usage

Create index.php:

<?php
require_once __DIR__ . '/vendor/autoload.php';

use Core\Route;
use Dotenv\Dotenv;

$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();

Route::setCacheFile($_ENV['ROUTE_CACHE_PATH'] ?? __DIR__ . '/storage/cache/routes.php');
require_once __DIR__ . '/routes/web.php';
Route::run();

Create routes/web.php for your API routes.

License

MIT