1. Go to this page and download the library: Download ovac/idoc 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/ */
ovac / idoc example snippets
$app->bind('path.public', function ($app) { return $app->basePath('../your-public-path'); });
$app->register(\OVAC\IDoc\IDocLumenServiceProvider::class);
return [
//...,
/*
* The routes for which documentation should be generated.
* Each group contains rules defining what routes should be termine what routes will be parsed in this group.
* A route must fulfill ALL conditions to pass.
*/
'match' => [
/*
* Match only routes whose domains match this pattern (use * as a wildcard to match any characters).
*/
'domains' => [
'*',
// 'domain1.*',
],
/*
* Match only routes whose paths match this pattern (use * as a wildcard to match any characters).
*/
'prefixes' => [
'api/*',
],
/*
* Match only routes registered under this version. This option is ignored for Laravel router.
* Note that wildcards are not supported.
*/
'versions' => [
'v1',
],
],
//...
],
],
/**
* @group User management
*
* APIs for managing users
*/
class UserController extends Controller
{
/**
* Create a user
*
* [Insert optional longer description of the API endpoint here.]
*
*/
public function createUser()
{
}
/**
* @group Account management
*
*/
public function changePassword()
{
}
}
/**
* @group Items
*/
class ItemController extends Controller
{
/**
* List items
*
* Get a list of items.
*
* @authenticated
* @responseFile responses/items.index.json
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//...
}
/**
* Store item
*
* Add a new item to the items collection.
*
* @bodyParam name string ate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//...
}
/**
* Get item
*
* Get item by it's unique ID.
*
* @pathParam item integer
/**
* @pathParam location_id he id of the user. Example: me
* @queryParam page _id string The id of the room.
* @bodyParam forever boolean Whether to ban the user forever. Example: false
*/
/**
* @bodyParam title string ired The title of the post.
* @bodyParam type string The type of post to create. Defaults to 'textophonious'.
* @bodyParam author_id int the ID of the author
* @bodyParam thumbnail image This is
/**
* @responseResource App\Http\Resources\OrderResource
*/
public function show($id)
{
return new OrderResource(Order::findOrFail($id));
}
/**
* @responseResource 201 App\Http\Resources\OrderResource
*/
public function store(Request $request)
{
$order = Order::create($request->all());
return new OrderResource($order);
}
/**
* @resourceName Order
* @resourceDescription Represents an order in the system
* @resourceStatus 200
*/
class OrderResource extends JsonResource
{
public function toArray($request)
{
return [
/**
* @responseParam id integer /**
* @responseParam items array * @responseParam name string
// routes/web.php
// Documentation for the ecommerce routes
Route::group([], function () {
// Set the idoc config to the ecommerce config
config(['idoc' => config('idoc.ecommerce')]);
// Define the route for the user documentation
Route::view(config('idoc.path'), 'idoc::documentation');
});
bash
php artisan vendor:publish --tag=idoc-config
bash
$ php artisan idoc:generate
sh
$ php artisan idoc:generate
sh
php artisan idoc:custom {config?}
php artisan idoc:custom ecommerce
php artisan idoc:custom ecommerce
php artisan idoc:custom user
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.