PHP code example of namchung / candy-api

1. Go to this page and download the library: Download namchung/candy-api 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/ */

    

namchung / candy-api example snippets


'providers' => [
  // ...
  
  GetCandy\Api\Providers\ApiServiceProvider::class,
  GetCandy\Api\Providers\EventServiceProvider::class,
  
  // If you have installed the hub, add this one
  GetCandy\Hub\Providers\HubServiceProvider::class
],

use GetCandy\Api\Core\Traits\HasCandy;

class User extends Authenticatable
{
    use HasCandy;

'guards' => [
  // ...
  
  'api' => [
     'driver' => 'passport',
     'provider' => 'users',
   ]
]

php artisan vendor:publish --tag=config

// If using the hub
php artisan vendor:publish --tag=public

php artisan candy:install