Skip to content

API Reference

Welcome to the Fluxor API Reference. Here you'll find detailed documentation for all core classes and methods.

Available Classes

ClassDescription
AppMain application entry point
RequestHTTP request handling
ResponseHTTP response building
FlowElegant route definitions
FetchLightweight HTTP client
CorsCross-Origin Resource Sharing configuration
HttpStatusCodeHTTP status code constants
HelpersGlobal helper functions

Quick Navigation

Core Classes

  • App - Application bootstrap and configuration
  • Request - Access request data, parameters, and headers
  • Response - Build JSON, HTML, and redirect responses

Routing

  • Flow - Chainable route definitions with HTTP methods
  • HttpStatusCode - Standard HTTP status code constants

Security & Configuration

  • Cors - Configure CORS globally or per-route
  • HttpStatusCode - Standard HTTP status code constants

Utilities

  • Helpers - Global helper functions for common tasks (env(), base_path(), config(), fetch(), etc.)

Examples

Basic Application

php
<?php
use Fluxor\App;
use Fluxor\Flow;
use Fluxor\Response;

$app = new Fluxor\App();
$app->run();

// Define a route
Flow::GET()->do(function($req) {
    return Response::json(['users' => []]);
});

Using Helpers

php
$baseUrl = base_url();
$config = config('app');
$data = fetch('GET', 'https://api.example.com/users')->json();

Making HTTP Requests

php
use Fluxor\Fetch;

// Simple GET
$users = Fetch::get('https://api.example.com/users')->json();

// POST with data
$user = Fetch::post('https://api.example.com/users', [
    'name' => 'John Doe'
])->json();

// With headers
$response = Fetch::get('https://api.example.com/me')
    ->header('Authorization', 'Bearer token')
    ->json();

Next Steps

  • Browse the App documentation to learn about configuration
  • Check Flow for routing examples
  • Check Response for building responses
  • Check Fetch for making HTTP requests
  • Check Cors for making CORS configuration
  • Check Helpers for global helper functions

Released under the MIT License.