Skip to main content

Getting Started with Phlame

To begin using Phlame, you'll need to:

  • Download the Framework: Access the source code from the official Phlame GitHub repository: https://github.com/Oryvex/Phlame.git

    • You can use git clone.

      git clone https://github.com/Oryvex/Phlame
    • Or you can download the direct zip file

  • Extract the Files: Phlame comes with it's directory structure, so you can easily start using it just after extracting it

  • Define Your Routes: Use Phlame's routing mechanism to map incoming requests to specific functions in your code that handle the API logic.

    index.php
    <?php 
    session_start();
    require_once '.config/_init.php';

    $router = new Router();

    $router->addRoute('/', function() {
    Source::set("index");
    });

    $router->route();
    ?>
  • Build Your API Logic: Implement the functionalities for each endpoint within the corresponding functions, utilizing Phlame's built-in features and your own custom logic as needed.

    source/index.src.php
    <?php 
    Source::empty($type, 'json');
    $segment = Api::segment('out', ["test" => "success"]);
    Api::send($segment, format: $type);
    ?>
  • Check The Output: The above example, routes the endpoint / to the source index at source/index.src.php. This will output the following

    https://yourwebsite.link/
    {
    "segments": {
    "out": {
    "test": "success"
    }
    }
    }