Browse Source

Simplify Dingo detection

shalvah 4 years ago
parent
commit
9704c428f7
7 changed files with 14 additions and 16 deletions
  1. 3 3
      .travis.yml
  2. 2 1
      CHANGELOG.md
  3. 1 1
      README.md
  4. 1 2
      composer.dingo.json
  5. 1 2
      composer.json
  6. 1 1
      docs/index.md
  7. 5 6
      src/Tools/DocumentationConfig.php

+ 3 - 3
.travis.yml

@@ -10,14 +10,14 @@ env:
 matrix:
   fast_finish: true
   include:
-    - php: 7.4.7
+    - php: 7.4
       env: COMPOSER=composer.dingo.json
       name: "With Dingo router"
-    - php: 7.4.7
+    - php: 7.4
       env: SETUP=lint
       name: "Lint code"
     - php: 7.4.7
-    - php: 7.4.7
+    - php: 7.4
       env: SETUP=lowest
     - php: 8.0
 

+ 2 - 1
CHANGELOG.md

@@ -23,4 +23,5 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
 - Removed continue_without_database_transactions
 - Support headers in response
 - Include responses in Postman collection
-- Body parameters array
+- Body parameters array
+- Auto detect Dingo

+ 1 - 1
README.md

@@ -30,7 +30,7 @@ Generate API documentation for humans from your Laravel codebase. [Here's what t
 Check out the documentation at [ReadTheDocs](http://scribe.rtfd.io/).
 
 ## Installation
-PHP 7.4.7 and Laravel/Lumen 6.0 or higher are required.
+PHP 7.4 and Laravel/Lumen 6.0 or higher are required.
 
 ```sh
 composer require --dev knuckleswtf/scribe

+ 1 - 2
composer.dingo.json

@@ -16,7 +16,7 @@
         }
     ],
     "require": {
-        "php": ">=7.4.7",
+        "php": ">=7.4",
         "ext-fileinfo": "*",
         "ext-json": "*",
         "ext-pdo": "*",
@@ -29,7 +29,6 @@
         "league/flysystem": "^1.0",
         "mpociot/reflection-docblock": "^1.0.1",
         "nunomaduro/collision": "^3.0|^4.0|^5.0",
-        "ocramius/package-versions": "^2.1",
         "ramsey/uuid": "^3.8|^4.0",
         "shalvah/clara": "^2.6",
         "spatie/data-transfer-object": "^2.6",

+ 1 - 2
composer.json

@@ -16,7 +16,7 @@
     }
   ],
   "require": {
-    "php": ">=7.4.7",
+    "php": ">=7.4",
     "ext-fileinfo": "*",
     "ext-json": "*",
     "ext-pdo": "*",
@@ -28,7 +28,6 @@
     "league/flysystem": "^1.0",
     "mpociot/reflection-docblock": "^1.0.1",
     "nunomaduro/collision": "^3.0|^4.0|^5.0",
-    "ocramius/package-versions": "^2.1",
     "ramsey/uuid": "^3.8|^4.0",
     "shalvah/clara": "^2.6",
     "spatie/data-transfer-object": "^2.6",

+ 1 - 1
docs/index.md

@@ -45,7 +45,7 @@ Generate API documentation for humans from your Laravel/Lumen/[Dingo](https://gi
 ```
 
 ## Installation
-PHP 7.4.7 and Laravel/Lumen 6 or higher are required.
+PHP 7.4 and Laravel/Lumen 6 or higher are required.
 
 ```sh
 composer require --dev knuckleswtf/scribe

+ 5 - 6
src/Tools/DocumentationConfig.php

@@ -28,13 +28,12 @@ class DocumentationConfig
             return $router;
         }
 
-        try {
-            $dingoVersion = \PackageVersions\Versions::getVersion('dingo/api');
-        } catch (\OutOfBoundsException $e) {
-            return 'laravel';
+        if (class_exists(\Dingo\Api\Routing\Router::class)) {
+            c::info('Detected Dingo API router');
+            return 'dingo';
         }
 
-        c::info('Detected Dingo API router');
-        return 'dingo';
+        return 'laravel';
+
     }
 }