PHP code example of sensorario / wheel-basic-app

1. Go to this page and download the library: Download sensorario/wheel-basic-app library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sensorario / wheel-basic-app example snippets




namespace MyApi\Controllers;

use Sensorario\WheelFramework\Controllers\Controller;

class DefaultController extends Controller
{
    public function default()
    {
        $response = [
            'message' => 'welcome',
        ];

        return $response;
    }
}



namespace MyApi\Components; 

use Sensorario\WheelFramework\Components\Config as SensorarioConfig;

class Config implements SensorarioConfig
{
    public function getConfig($key)
    {
        return array(

            'routes' => array(
                <path> => array(
                    'controller' => <controller>,
                    <http method> => array(
                        'action' => <method>
                    )
                )
            ),

        )[$key];
    }
}

'/devel/info' => array(
    'controller' => 'Vendor\\Controllers\\DevelController',
    'GET' => array(
        'action' => 'show'
    )
)

 return array(
    'driver'   => 'pdo_mysql',
    'dbname'   => 'my_api',
    'user'     => 'root',
    'password' => '',
);
bash
 ├── app
 │   └── config
 │       └── config.db.php
 ├── src
 │   └── MyApi
 │       ├── Components
 │       │   └── Config.php
 │       └── Controllers
 │           └── DefaultController.php
 ├── web
 │   └── index.php
 ├── composer.json
 ├── composer.lock
 └── readme.md