Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make blueprint an optional dependency #52

Merged
merged 1 commit into from
Jul 23, 2024
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
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]);
}
}
}