Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.1.3
- 7.2

before_script:
- travis_retry composer self-update
Expand Down
22 changes: 12 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,24 @@
}
],
"require": {
"php": ">=5.5.0",
"fzaninotto/faker": "~1.0",
"laravel/framework": "~5.4",
"php": ">=7.0.0",
"fzaninotto/faker": "~1.8",
"illuminate/routing": "5.5.* || 5.6.* || 5.7.*",
"illuminate/support": "5.5.* 5.6.* || 5.7.*",
"illuminate/console": "5.5.* 5.6.* || 5.7.*",
"mpociot/documentarian": "^0.2.0",
"mpociot/reflection-docblock": "^1.0",
"ramsey/uuid": "^3.0"
"ramsey/uuid": "^3.8"
},
"require-dev": {
"orchestra/testbench": "~3.0",
"phpunit/phpunit": "~4.0 || ~5.0",
"dingo/api": "1.0.*@dev",
"mockery/mockery": "^0.9.5"
"orchestra/testbench": "3.5.* || 3.6.* || 3.7.*",
"phpunit/phpunit": "^6.0.0 || ^7.4.0",
"dingo/api": "2.0.0-alpha1",
"mockery/mockery": "^1.2.0"
},
"autoload": {
"psr-0": {
"Mpociot\\ApiDoc": "src/"
"psr-4": {
"Mpociot\\ApiDoc\\": "src/"
}
},
"autoload-dev": {
Expand Down
95 changes: 95 additions & 0 deletions config/apidoc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

return [

/*
* The output path for the generated documentation.
*/
'output' => 'public/docs',


/*
* The router to be used (Laravel or Dingo).
*/
'router' => 'laravel',

/*
* Generate a Postman collection in addition to HTML docs.
*/
'postman' => true,


/*
* The routes for which documentation should be generated.
* Each group contains rules defining which routes should be included ('match', 'include' and 'exclude' sections)
* and rules which should be applied to them ('apply' section).
*/
'routes' => [
[
/*
* Specify conditions to determine 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' => [
'*',
// 'users/*',
],

/*
* Match only routes registered under this version. This option is ignored for Laravel router.
* Note that wildcards are not supported.
*/
'versions' => [
'v1',
],
],

/*
* Include these routes when generating documentation,
* even if they did not match the rules above.
* Note that the route must be referenced by name here.
*/
'include' => [
// 'users.index',
],

/*
* Exclude these routes when generating documentation,
* even if they matched the rules above.
* Note that the route must be referenced by name here.
*/
'exclude' => [
// 'users.create',
],

/*
* Specify rules to be applied to all the routes in this group when generating documentation
*/
'apply' => [
'requests' => [

/*
* Specify headers to be added to the example requests
*/
'headers' => [
// 'Authorization' => 'Bearer: {token}',
// 'Api-Version' => 'v2',
],
],
],
],
],
];
9 changes: 4 additions & 5 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true"
syntaxCheck="false">
stopOnFailure="true">
<testsuites>
<testsuite name="Versionable Suite">
<directory>tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/Mpociot/</directory>
<directory suffix=".php">src/</directory>
<exclude>
<file>src/Mpociot/ApiDoc/ApiDocGeneratorServiceProvider.php</file>
<file>src/resources/views/documentarian.blade.php</file>
<file>src/ApiDocGeneratorServiceProvider.php</file>
<file>resources/views/documentarian.blade.php</file>
</exclude>
</whitelist>
</filter>
Expand Down
45 changes: 45 additions & 0 deletions src/ApiDocGeneratorServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Mpociot\ApiDoc;

use Illuminate\Support\ServiceProvider;
use Mpociot\ApiDoc\Commands\UpdateDocumentation;
use Mpociot\ApiDoc\Commands\GenerateDocumentation;

class ApiDocGeneratorServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->loadViewsFrom(__DIR__ . '/../resources/views/', 'apidoc');

$this->publishes([
__DIR__ . '/../resources/views' => app()->basePath().'/resources/views/vendor/apidoc',
], 'views');

$this->publishes([
__DIR__.'/../config/apidoc.php' => config_path('apidoc.php'),
], 'config');

if ($this->app->runningInConsole()) {
$this->commands([
GenerateDocumentation::class,
UpdateDocumentation::class,
]);
}
}

/**
* Register the API doc commands.
*
* @return void
*/
public function register()
{
//
}
}
Loading