https://github.com/phphleb/radjax
Fast Ajax- and API-router for PHP Micro-Framework HLEB
https://github.com/phphleb/radjax
Last synced: over 1 year ago
JSON representation
Fast Ajax- and API-router for PHP Micro-Framework HLEB
- Host: GitHub
- URL: https://github.com/phphleb/radjax
- Owner: phphleb
- Created: 2019-07-12T17:29:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-23T18:22:40.000Z (about 4 years ago)
- Last Synced: 2025-02-14T07:17:00.037Z (over 1 year ago)
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Radjax (fast Ajax- and API-router)
### 
The Radjax is not included in the original configuration of the framework [HLEB](https://github.com/phphleb/hleb), so it must be copied to the folder with the vendor/phphleb libraries from the [github.com/phphleb/radjax](https://github.com/phphleb/radjax) repository or installed using Composer:
```bash
$ composer require phphleb/radjax
```
Connection to the project in /routes/radjax.php (are priority)
```php
Radjax\Route::get("/info/", ["get"], "App\Controllers\TestController@index", ["protected"=>false]);
// and advanced customization
Radjax\Route::get("/weather/{y}/{m}/{d}/{h?}/", ["get","post"], "App\Controllers\TestController@weather", ["protected"=>true, "where"=>["y"=>"[0-9]+", "m"=>"[0-9]+", "d"=>"[0-9]+", "h"=>"[0-9]+"], "session_saved" => false]);
```
Connection separate from HLEB :
```php
// require or through classes autoloader
require '/vendor-directory/phphleb/radjax/Route.php';
require '/vendor-directory/phphleb/radjax/Src/RCreator.php';
require '/vendor-directory/phphleb/radjax/Src/App.php';
// Initialization with the path to the route file.
// If the route was found, boolean `true` will be returned, else `false`.
$isActive = (new Radjax\Src\App(['/path-to-directory/routes/radjax-route.php']))->get();
```