PHP code example of php-resta / skeleton

1. Go to this page and download the library: Download php-resta/skeleton 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/ */

    

php-resta / skeleton example snippets

bash
$ composer create-project php-resta/skeleton company_name dev-master
bash
$ php api project create demo
code
Demo/
|
|- Api/
|  |- V1/
|     |- Config/
|        |- App.php
|        |- Authenticate.php
|        |- AutoServices.php
|        |- Cache.php
|        |- Database.php
|        |- Hateoas.php
|        |- Redis.php
|        |- Slack.php
|     |- Middleware/
|        |- Authenticate.php
|        |- ClientApiToken.php
|        |- RateLimit.php
|        |- SetClientTimezone.php
|        |- TrustedProxies.php   
|     |- ServiceAnnotationsManager.php
|     |- ServiceEventDispatcherManager.php
|     |- ServiceLogManager.php
|     |- ServiceMiddlewareManager.php  
|
|- Kernel/
|  |- Node/
|     |- index.html
|  |- Providers/
|     |- AppServiceProvider.php
|     |- ConsoleEventServiceProvider.php
|     |- RouteServiceProvider.php
|  |- Stub/
|     |- index.html
|  |- Kernel.php
|  |- Version.php
|
|- Storage/
|  |- Language
|  |- Log
|  |- Resource
|  |- index.html
|
|- Tests/
|  |- index.html
|
|- Webservice/
|  |- index.html
|
|- .gitignore
|- composer.json
|- README.md

bash
$ php api controller create demo controller:users
code


namespace App\Demo\Api\V1\Controllers\Users;

class UsersController extends App
{
    /**
     * #define: get Users
     *
     * @return mixed|array
     */
    public function index()
    {
        return [
            'endpoint'=>'Users'
        ];
    }
}