Skip to content

Commit

Permalink
Make blueprint an optional dependency (#52)
Browse files Browse the repository at this point in the history
Fix up CI image
  • Loading branch information
specialtactics authored Jul 23, 2024
1 parent 525d2f7 commit aac28a4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
}],
"require": {
"php": "^8.0",
"dingo/blueprint": "~0.4",
"illuminate/routing": "^9.0|^10.0|^11.0",
"illuminate/support": "^9.0|^10.0|^11.0",
"league/fractal": "^0.20"
Expand All @@ -33,10 +32,13 @@
"mockery/mockery": "~1.0",
"phpunit/phpunit": "^9.0|^10.0",
"squizlabs/php_codesniffer": "~2.0",
"php-open-source-saver/jwt-auth": "^1.4 | ^2.2"
"php-open-source-saver/jwt-auth": "^1.4 | ^2.2",
"dingo/blueprint": "~0.4"
},
"suggest": {
"php-open-source-saver/jwt-auth": "Protect your API with JSON Web Tokens."
"php-open-source-saver/jwt-auth": "Protect your API with JSON Web Tokens.",
"specialtactics/laravel-api-boilerplate": "API Boilerplate for Laravel",
"dingo/blueprint": "Legacy package which can produce API docs from dingo/api"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Please note, we do not actively maintain the Lumen support of this project. If y

The Dingo API package is meant to provide you, the developer, with a set of tools to help you easily and quickly build your own API. While the goal of this package is to remain as flexible as possible it still won't cover all situations and solve all problems.

[!Build Status](https://github.com/api-ecosystem-for-laravel/dingo-api/actions/workflows/ci.yml/badge.svg?branch=master)
[![CI Tests](https://github.com/api-ecosystem-for-laravel/dingo-api/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/api-ecosystem-for-laravel/dingo-api/actions)
[![License](https://img.shields.io/packagist/l/api-ecosystem-for-laravel/dingo-api.svg?style=flat-square)](LICENSE)
[![Development Version](https://img.shields.io/packagist/vpre/api-ecosystem-for-laravel/dingo-api.svg?style=flat-square)](https://packagist.org/packages/api-ecosystem-for-laravel/dingo-api)
[![Monthly Installs](https://img.shields.io/packagist/dm/api-ecosystem-for-laravel/dingo-api.svg?style=flat-square)](https://packagist.org/packages/api-ecosystem-for-laravel/dingo-api)
Expand Down
24 changes: 13 additions & 11 deletions src/Provider/DingoServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,18 @@ protected function registerTransformer()
*/
protected function registerDocsCommand()
{
$this->app->singleton(\Dingo\Api\Console\Command\Docs::class, function ($app) {
return new Command\Docs(
$app[\Dingo\Api\Routing\Router::class],
$app[\Dingo\Blueprint\Blueprint::class],
$app[\Dingo\Blueprint\Writer::class],
$this->config('name'),
$this->config('version')
);
});

$this->commands([\Dingo\Api\Console\Command\Docs::class]);
if (class_exists(\Dingo\Blueprint\Blueprint::class)) {
$this->app->singleton(\Dingo\Api\Console\Command\Docs::class, function ($app) {
return new Command\Docs(
$app[\Dingo\Api\Routing\Router::class],
$app[\Dingo\Blueprint\Blueprint::class],
$app[\Dingo\Blueprint\Writer::class],
$this->config('name'),
$this->config('version')
);
});

$this->commands([\Dingo\Api\Console\Command\Docs::class]);
}
}
}

0 comments on commit aac28a4

Please sign in to comment.