Full Code of dingo/api for AI

master 42b6afa6e20a cached
140 files
390.2 KB
96.1k tokens
1010 symbols
1 requests
Download .txt
Showing preview only (425K chars total). Download the full file or copy to clipboard to get everything.
Repository: dingo/api
Branch: master
Commit: 42b6afa6e20a
Files: 140
Total size: 390.2 KB

Directory structure:
gitextract_9d3mtabi/

├── .editorconfig
├── .gitattributes
├── .github/
│   └── ISSUE_TEMPLATE.md
├── .gitignore
├── .styleci.yml
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── composer.json
├── config/
│   └── api.php
├── phpunit.xml.dist
├── readme.md
├── src/
│   ├── Auth/
│   │   ├── Auth.php
│   │   └── Provider/
│   │       ├── Authorization.php
│   │       ├── Basic.php
│   │       └── JWT.php
│   ├── Console/
│   │   └── Command/
│   │       ├── Cache.php
│   │       ├── Docs.php
│   │       └── Routes.php
│   ├── Contract/
│   │   ├── Auth/
│   │   │   └── Provider.php
│   │   ├── Debug/
│   │   │   ├── ExceptionHandler.php
│   │   │   └── MessageBagErrors.php
│   │   ├── Http/
│   │   │   ├── Parser.php
│   │   │   ├── RateLimit/
│   │   │   │   ├── HasRateLimiter.php
│   │   │   │   └── Throttle.php
│   │   │   ├── Request.php
│   │   │   └── Validator.php
│   │   ├── Routing/
│   │   │   └── Adapter.php
│   │   └── Transformer/
│   │       └── Adapter.php
│   ├── Dispatcher.php
│   ├── Event/
│   │   ├── RequestWasMatched.php
│   │   ├── ResponseIsMorphing.php
│   │   └── ResponseWasMorphed.php
│   ├── Exception/
│   │   ├── DeleteResourceFailedException.php
│   │   ├── Handler.php
│   │   ├── InternalHttpException.php
│   │   ├── RateLimitExceededException.php
│   │   ├── ResourceException.php
│   │   ├── StoreResourceFailedException.php
│   │   ├── UnknownVersionException.php
│   │   ├── UpdateResourceFailedException.php
│   │   └── ValidationHttpException.php
│   ├── Facade/
│   │   ├── API.php
│   │   └── Route.php
│   ├── Http/
│   │   ├── FormRequest.php
│   │   ├── InternalRequest.php
│   │   ├── Middleware/
│   │   │   ├── Auth.php
│   │   │   ├── PrepareController.php
│   │   │   ├── RateLimit.php
│   │   │   └── Request.php
│   │   ├── Parser/
│   │   │   └── Accept.php
│   │   ├── RateLimit/
│   │   │   ├── Handler.php
│   │   │   └── Throttle/
│   │   │       ├── Authenticated.php
│   │   │       ├── Route.php
│   │   │       ├── Throttle.php
│   │   │       └── Unauthenticated.php
│   │   ├── Request.php
│   │   ├── RequestValidator.php
│   │   ├── Response/
│   │   │   ├── Factory.php
│   │   │   └── Format/
│   │   │       ├── Format.php
│   │   │       ├── Json.php
│   │   │       ├── JsonOptionalFormatting.php
│   │   │       └── Jsonp.php
│   │   ├── Response.php
│   │   └── Validation/
│   │       ├── Accept.php
│   │       ├── Domain.php
│   │       └── Prefix.php
│   ├── Provider/
│   │   ├── DingoServiceProvider.php
│   │   ├── HttpServiceProvider.php
│   │   ├── LaravelServiceProvider.php
│   │   ├── LumenServiceProvider.php
│   │   ├── RoutingServiceProvider.php
│   │   └── ServiceProvider.php
│   ├── Routing/
│   │   ├── Adapter/
│   │   │   ├── Laravel.php
│   │   │   └── Lumen.php
│   │   ├── Helpers.php
│   │   ├── ResourceRegistrar.php
│   │   ├── Route.php
│   │   ├── RouteCollection.php
│   │   ├── Router.php
│   │   └── UrlGenerator.php
│   ├── Transformer/
│   │   ├── Adapter/
│   │   │   └── Fractal.php
│   │   ├── Binding.php
│   │   └── Factory.php
│   └── helpers.php
└── tests/
    ├── Auth/
    │   ├── AuthTest.php
    │   └── Provider/
    │       ├── AuthorizationTest.php
    │       ├── BasicTest.php
    │       └── JWTTest.php
    ├── BaseTestCase.php
    ├── ChecksLaravelVersionTrait.php
    ├── DispatcherTest.php
    ├── Exception/
    │   └── HandlerTest.php
    ├── Http/
    │   ├── Middleware/
    │   │   ├── AuthTest.php
    │   │   ├── RateLimitTest.php
    │   │   └── RequestTest.php
    │   ├── Parser/
    │   │   └── AcceptTest.php
    │   ├── RateLimit/
    │   │   ├── HandlerTest.php
    │   │   └── Throttle/
    │   │       ├── AuthenticatedTest.php
    │   │       └── UnauthenticatedTest.php
    │   ├── RequestValidatorTest.php
    │   ├── Response/
    │   │   ├── FactoryTest.php
    │   │   └── Format/
    │   │       ├── ExpectedPrettyPrintedJson/
    │   │       │   ├── testMorphingArrayWithEightSpacesPrettyPrintIndent.json.php
    │   │       │   ├── testMorphingArrayWithFourSpacesPrettyPrintIndent.json.php
    │   │       │   ├── testMorphingArrayWithOneTabPrettyPrintIndent.json.php
    │   │       │   └── testMorphingArrayWithTwoSpacesPrettyPrintIndent.json.php
    │   │       ├── ExpectedPrettyPrintedJsonp/
    │   │       │   ├── testMorphingArrayWithEightSpacesPrettyPrintIndent.jsonp.php
    │   │       │   ├── testMorphingArrayWithFourSpacesPrettyPrintIndent.jsonp.php
    │   │       │   ├── testMorphingArrayWithOneTabPrettyPrintIndent.jsonp.php
    │   │       │   └── testMorphingArrayWithTwoSpacesPrettyPrintIndent.jsonp.php
    │   │       ├── JsonTest.php
    │   │       └── JsonpTest.php
    │   ├── ResponseTest.php
    │   └── Validation/
    │       ├── AcceptTest.php
    │       ├── DomainTest.php
    │       └── PrefixTest.php
    ├── Routing/
    │   ├── Adapter/
    │   │   ├── BaseAdapterTest.php
    │   │   ├── LaravelTest.php
    │   │   └── LumenTest.php
    │   ├── RouteTest.php
    │   └── RouterTest.php
    ├── Stubs/
    │   ├── Application58Stub.php
    │   ├── Application6Stub.php
    │   ├── Application7Stub.php
    │   ├── Application8Stub.php
    │   ├── ApplicationStub.php
    │   ├── AuthorizationProviderStub.php
    │   ├── BasicThrottleStub.php
    │   ├── EloquentModelStub.php
    │   ├── HttpValidatorStub.php
    │   ├── MiddlewareStub.php
    │   ├── RoutingAdapterStub.php
    │   ├── RoutingControllerOtherStub.php
    │   ├── RoutingControllerStub.php
    │   ├── ThrottleStub.php
    │   ├── TransformerStub.php
    │   ├── UserStub.php
    │   └── UserTransformerStub.php
    └── Transformer/
        ├── Adapter/
        │   └── FractalTest.php
        └── FactoryTest.php

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
root = true

[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[*.yml]
indent_style = space
indent_size = 2


================================================
FILE: .gitattributes
================================================
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
/README.md export-ignore
/.github/


================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
| Q                 | A
| ----------------- | ---
| Bug?              | no|yes
| New Feature?      | no|yes
| Framework         | Laravel|Lumen
| Framework version | 5.x.y
| Package version   | 1.x.y
| PHP version       | 5.x.y|7.x.y

#### Actual Behaviour

Describe the behaviour you're experiencing. Do not just copy and paste a random error message and expect help.


#### Expected Behaviour

Describe the behaviour you're expecting.


#### Steps to Reproduce

List all the steps needed to reproduce the issue you're having. Make sure to include code (affected models, configurations),
any screenshots and/or other resources that may help us understand what's going on.


#### Possible Solutions

If you have any ideas on how to solve the issue, add them here, otherwise you can omit this part.


================================================
FILE: .gitignore
================================================
.php_cs.cache
.idea
composer.lock
phpunit.xml
storage
vendor
.php_cs


================================================
FILE: .styleci.yml
================================================
preset: laravel

disabled:
  - alpha_ordered_imports

enabled:
  - phpdoc_order
  - phpdoc_separation
  - unalign_double_arrow


================================================
FILE: .travis.yml
================================================
language: php

sudo: false
dist: trusty

env:
  global:
    - setup=basic
    - xdebug=true

cache:
  directories:
    - $HOME/.composer/cache

matrix:
  include:
    - php: 7.2
      env: xdebug=false
    - php: 7.3
      env: xdebug=false
    - php: 7.4
      env: xdebug=false

before_install:
  - if [[ $xdebug = 'true' ]] ; then phpenv config-rm xdebug.ini; fi

install:
  - if [[ $setup = 'basic' ]]; then travis_retry composer install --prefer-dist --no-interaction --no-suggest; fi
  - if [[ $setup = 'stable' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable; fi
  - if [[ $setup = 'lowest' ]]; then travis_retry composer update --prefer-dist --no-interaction --no-suggest --prefer-stable --prefer-lowest; fi

script:
  - vendor/bin/phpunit


================================================
FILE: CONTRIBUTING.md
================================================
# CONTRIBUTING

Contributions are welcome, and are accepted via pull requests. Please review these guidelines before submitting any pull requests.

## Guidelines

* Please follow the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md).
* Ensure that the current tests pass, and if you've added something new, add the tests where relevant.
* Remember that we follow [SemVer](http://semver.org). If you are changing the behaviour, or the public api, you may need to update the docs.
* Send a coherent commit history, making sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash](http://git-scm.com/book/en/Git-Tools-Rewriting-History) them before submitting.
* You may also need to [rebase](http://git-scm.com/book/en/Git-Branching-Rebasing) to avoid merge conflicts.

## Running Tests

You will need an install of [Composer](https://getcomposer.org) before continuing.

First, install the dependencies:

```bash
$ composer install
```

Then run phpunit:

```bash
$ vendor/bin/phpunit
```

If the test suite passes on your local machine you should be good to go.

When you make a pull request, the tests will automatically be run again by [Travis CI](https://travis-ci.org/) on multiple php versions and hhvm.


================================================
FILE: LICENSE
================================================
Copyright (c) 2014-2015, Jason Lewis
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

* Neither the name of Dingo API nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: composer.json
================================================
{
    "name": "dingo/api",
    "description": "A RESTful API package for the Laravel and Lumen frameworks.",
    "keywords": [
        "api",
        "dingo",
        "laravel",
        "restful"
    ],
    "license": "BSD-3-Clause",
    "authors": [{
        "name": "Jason Lewis",
        "email": "jason.lewis1991@gmail.com"
    }],
    "require": {
        "php": "^7.2.5|^8.0",
        "dingo/blueprint": "^0.4",
        "illuminate/routing": "^7.0|^8.0",
        "illuminate/support": "^7.0|^8.0",
        "league/fractal": "^0.19"
    },
    "require-dev": {
        "friendsofphp/php-cs-fixer": "~2",
        "illuminate/auth": "^7.0|^8.0",
        "illuminate/cache": "^7.0|^8.0",
        "illuminate/console": "^7.0|^8.0",
        "illuminate/database": "^7.0|^8.0",
        "illuminate/events": "^7.0|^8.0",
        "illuminate/filesystem": "^7.0|^8.0",
        "illuminate/log": "^7.0|^8.0",
        "illuminate/pagination": "^7.0|^8.0",
        "laravel/lumen-framework": "^7.0|^8.0",
        "mockery/mockery": "~1.0",
        "phpunit/phpunit": "^8.5|^9.0",
        "squizlabs/php_codesniffer": "~2.0",
        "tymon/jwt-auth": "1.0.*"
    },
    "suggest": {
        "tymon/jwt-auth": "Protect your API with JSON Web Tokens."
    },
    "abandoned": "api-ecosystem-for-laravel/dingo-api",
    "autoload": {
        "psr-4": {
            "Dingo\\Api\\": "src/"
        },
        "files": [
            "src/helpers.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Dingo\\Api\\Tests\\": "tests/"
        }
    },
    "extra": {
        "branch-alias": {
            "dev-master": "2.0-dev"
        },
        "laravel": {
            "providers": [
                "Dingo\\Api\\Provider\\LaravelServiceProvider"
            ],
            "aliases": {
                "API": "Dingo\\Api\\Facade\\API"
            }
        }
    },
    "config": {
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}


================================================
FILE: config/api.php
================================================
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Standards Tree
    |--------------------------------------------------------------------------
    |
    | Versioning an API with Dingo revolves around content negotiation and
    | custom MIME types. A custom type will belong to one of three
    | standards trees, the Vendor tree (vnd), the Personal tree
    | (prs), and the Unregistered tree (x).
    |
    | By default the Unregistered tree (x) is used, however, should you wish
    | to you can register your type with the IANA. For more details:
    | https://tools.ietf.org/html/rfc6838
    |
    */

    'standardsTree' => env('API_STANDARDS_TREE', 'x'),

    /*
    |--------------------------------------------------------------------------
    | API Subtype
    |--------------------------------------------------------------------------
    |
    | Your subtype will follow the standards tree you use when used in the
    | "Accept" header to negotiate the content type and version.
    |
    | For example: Accept: application/x.SUBTYPE.v1+json
    |
    */

    'subtype' => env('API_SUBTYPE', ''),

    /*
    |--------------------------------------------------------------------------
    | Default API Version
    |--------------------------------------------------------------------------
    |
    | This is the default version when strict mode is disabled and your API
    | is accessed via a web browser. It's also used as the default version
    | when generating your APIs documentation.
    |
    */

    'version' => env('API_VERSION', 'v1'),

    /*
    |--------------------------------------------------------------------------
    | Default API Prefix
    |--------------------------------------------------------------------------
    |
    | A default prefix to use for your API routes so you don't have to
    | specify it for each group.
    |
    */

    'prefix' => env('API_PREFIX', null),

    /*
    |--------------------------------------------------------------------------
    | Default API Domain
    |--------------------------------------------------------------------------
    |
    | A default domain to use for your API routes so you don't have to
    | specify it for each group.
    |
    */

    'domain' => env('API_DOMAIN', null),

    /*
    |--------------------------------------------------------------------------
    | Name
    |--------------------------------------------------------------------------
    |
    | When documenting your API using the API Blueprint syntax you can
    | configure a default name to avoid having to manually specify
    | one when using the command.
    |
    */

    'name' => env('API_NAME', null),

    /*
    |--------------------------------------------------------------------------
    | Conditional Requests
    |--------------------------------------------------------------------------
    |
    | Globally enable conditional requests so that an ETag header is added to
    | any successful response. Subsequent requests will perform a check and
    | will return a 304 Not Modified. This can also be enabled or disabled
    | on certain groups or routes.
    |
    */

    'conditionalRequest' => env('API_CONDITIONAL_REQUEST', true),

    /*
    |--------------------------------------------------------------------------
    | Strict Mode
    |--------------------------------------------------------------------------
    |
    | Enabling strict mode will require clients to send a valid Accept header
    | with every request. This also voids the default API version, meaning
    | your API will not be browsable via a web browser.
    |
    */

    'strict' => env('API_STRICT', false),

    /*
    |--------------------------------------------------------------------------
    | Debug Mode
    |--------------------------------------------------------------------------
    |
    | Enabling debug mode will result in error responses caused by thrown
    | exceptions to have a "debug" key that will be populated with
    | more detailed information on the exception.
    |
    */

    'debug' => env('API_DEBUG', false),

    /*
    |--------------------------------------------------------------------------
    | Generic Error Format
    |--------------------------------------------------------------------------
    |
    | When some HTTP exceptions are not caught and dealt with the API will
    | generate a generic error response in the format provided. Any
    | keys that aren't replaced with corresponding values will be
    | removed from the final response.
    |
    */

    'errorFormat' => [
        'message' => ':message',
        'errors' => ':errors',
        'code' => ':code',
        'status_code' => ':status_code',
        'debug' => ':debug',
    ],

    /*
    |--------------------------------------------------------------------------
    | API Middleware
    |--------------------------------------------------------------------------
    |
    | Middleware that will be applied globally to all API requests.
    |
    */

    'middleware' => [

    ],

    /*
    |--------------------------------------------------------------------------
    | Authentication Providers
    |--------------------------------------------------------------------------
    |
    | The authentication providers that should be used when attempting to
    | authenticate an incoming API request.
    |
    */

    'auth' => [

    ],

    /*
    |--------------------------------------------------------------------------
    | Throttling / Rate Limiting
    |--------------------------------------------------------------------------
    |
    | Consumers of your API can be limited to the amount of requests they can
    | make. You can create your own throttles or simply change the default
    | throttles.
    |
    */

    'throttling' => [

    ],

    /*
    |--------------------------------------------------------------------------
    | Response Transformer
    |--------------------------------------------------------------------------
    |
    | Responses can be transformed so that they are easier to format. By
    | default a Fractal transformer will be used to transform any
    | responses prior to formatting. You can easily replace
    | this with your own transformer.
    |
    */

    'transformer' => env('API_TRANSFORMER', Dingo\Api\Transformer\Adapter\Fractal::class),

    /*
    |--------------------------------------------------------------------------
    | Response Formats
    |--------------------------------------------------------------------------
    |
    | Responses can be returned in multiple formats by registering different
    | response formatters. You can also customize an existing response
    | formatter with a number of options to configure its output.
    |
    */

    'defaultFormat' => env('API_DEFAULT_FORMAT', 'json'),

    'formats' => [

        'json' => Dingo\Api\Http\Response\Format\Json::class,

    ],

    'formatsOptions' => [

        'json' => [
            'pretty_print' => env('API_JSON_FORMAT_PRETTY_PRINT_ENABLED', false),
            'indent_style' => env('API_JSON_FORMAT_INDENT_STYLE', 'space'),
            'indent_size' => env('API_JSON_FORMAT_INDENT_SIZE', 2),
        ],

    ],

];


================================================
FILE: phpunit.xml.dist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         beStrictAboutTestsThatDoNotTestAnything="true"
         beStrictAboutOutputDuringTests="true"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         failOnRisky="true"
         failOnWarning="true"
         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         verbose="true"
    >
    <testsuites>
        <testsuite name="API Test Suite">
            <directory suffix="Test.php">./tests</directory>
            <exclude>./tests/Routing/Adapter/LumenTest.php</exclude>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./src</directory>
        </whitelist>
    </filter>
</phpunit>


================================================
FILE: readme.md
================================================
# Move repositories notice
Unfortunately this package cannot be maintained at this location anymore due to broken CI integrations, and travis-ci likely can't be used much longer either due to their change to paid plans. This project is still being actively maintained, we ask you to please switch to the following repository: https://github.com/api-ecosystem-for-laravel/dingo-api

---

![](https://cloud.githubusercontent.com/assets/829059/9216039/82be51cc-40f6-11e5-88f5-f0cbd07bcc39.png)

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://img.shields.io/travis/dingo/api/master.svg?style=flat-square)](https://travis-ci.org/dingo/api)
[![License](https://img.shields.io/packagist/l/dingo/api.svg?style=flat-square)](LICENSE)
[![Development Version](https://img.shields.io/packagist/vpre/dingo/api.svg?style=flat-square)](https://packagist.org/packages/dingo/api)
[![Monthly Installs](https://img.shields.io/packagist/dm/dingo/api.svg?style=flat-square)](https://packagist.org/packages/dingo/api)
[![StyleCI](https://styleci.io/repos/18673522/shield)](https://styleci.io/repos/18673522)

## Features

This package provides tools for the following, and more:

- Content Negotiation
- Multiple Authentication Adapters
- API Versioning
- Rate Limiting
- Response Transformers and Formatters
- Error and Exception Handling
- Internal Requests
- API Blueprint Documentation

## Documentation

Please refer to our extensive [Wiki documentation](https://github.com/dingo/api/wiki) for more information.

## API Boilerplate

If you are looking to start a new project from scratch, consider using the [Laravel API Boilerplate](https://github.com/specialtactics/laravel-api-boilerplate), which builds on top of the dingo-api package, and adds a lot of great features.

## Support

For answers you may not find in the Wiki, avoid posting issues. Feel free to ask for support on the dedicated [Slack](https://larachat.slack.com/messages/api/) room. Make sure to mention **specialtactics** so he is notified.

## License

This package is licensed under the [BSD 3-Clause license](http://opensource.org/licenses/BSD-3-Clause).


================================================
FILE: src/Auth/Auth.php
================================================
<?php

namespace Dingo\Api\Auth;

use Exception;
use Dingo\Api\Routing\Router;
use Illuminate\Container\Container;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;

class Auth
{
    /**
     * Router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * Illuminate container instance.
     *
     * @var \Illuminate\Container\Container
     */
    protected $container;

    /**
     * Array of available authentication providers.
     *
     * @var array
     */
    protected $providers;

    /**
     * The provider used for authentication.
     *
     * @var \Dingo\Api\Contract\Auth\Provider
     */
    protected $providerUsed;

    /**
     * Authenticated user instance.
     *
     * @var \Illuminate\Auth\GenericUser|\Illuminate\Database\Eloquent\Model
     */
    protected $user;

    /**
     * Create a new auth instance.
     *
     * @param \Dingo\Api\Routing\Router       $router
     * @param \Illuminate\Container\Container $container
     * @param array                           $providers
     *
     * @return void
     */
    public function __construct(Router $router, Container $container, array $providers)
    {
        $this->router = $router;
        $this->container = $container;
        $this->providers = $providers;
    }

    /**
     * Authenticate the current request.
     *
     * @param array $providers
     *
     * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
     *
     * @return mixed
     */
    public function authenticate(array $providers = [])
    {
        $exceptionStack = [];

        // Spin through each of the registered authentication providers and attempt to
        // authenticate through one of them. This allows a developer to implement
        // and allow a number of different authentication mechanisms.
        foreach ($this->filterProviders($providers) as $provider) {
            try {
                $user = $provider->authenticate($this->router->getCurrentRequest(), $this->router->getCurrentRoute());

                $this->providerUsed = $provider;

                return $this->user = $user;
            } catch (UnauthorizedHttpException $exception) {
                $exceptionStack[] = $exception;
            } catch (BadRequestHttpException $exception) {
                // We won't add this exception to the stack as it's thrown when the provider
                // is unable to authenticate due to the correct authorization header not
                // being set. We will throw an exception for this below.
            }
        }

        $this->throwUnauthorizedException($exceptionStack);
    }

    /**
     * Throw the first exception from the exception stack.
     *
     * @param array $exceptionStack
     *
     * @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
     *
     * @return void
     */
    protected function throwUnauthorizedException(array $exceptionStack)
    {
        $exception = array_shift($exceptionStack);

        if ($exception === null) {
            $exception = new UnauthorizedHttpException('dingo', 'Failed to authenticate because of bad credentials or an invalid authorization header.');
        }

        throw $exception;
    }

    /**
     * Filter the requested providers from the available providers.
     *
     * @param array $providers
     *
     * @return array
     */
    protected function filterProviders(array $providers)
    {
        if (empty($providers)) {
            return $this->providers;
        }

        return array_intersect_key($this->providers, array_flip($providers));
    }

    /**
     * Get the authenticated user.
     *
     * @param bool $authenticate
     *
     * @return \Illuminate\Auth\GenericUser|\Illuminate\Database\Eloquent\Model|null
     */
    public function getUser($authenticate = true)
    {
        if ($this->user) {
            return $this->user;
        } elseif (! $authenticate) {
            return;
        }

        try {
            return $this->user = $this->authenticate();
        } catch (Exception $exception) {
            return;
        }
    }

    /**
     * Alias for getUser.
     *
     * @param bool $authenticate
     *
     * @return \Illuminate\Auth\GenericUser|\Illuminate\Database\Eloquent\Model
     */
    public function user($authenticate = true)
    {
        return $this->getUser($authenticate);
    }

    /**
     * Set the authenticated user.
     *
     * @param \Illuminate\Auth\GenericUser|\Illuminate\Database\Eloquent\Model $user
     *
     * @return \Dingo\Api\Auth\Auth
     */
    public function setUser($user)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Check if a user has authenticated with the API.
     *
     * @param bool $authenticate
     *
     * @return bool
     */
    public function check($authenticate = false)
    {
        return ! is_null($this->user($authenticate));
    }

    /**
     * Get the provider used for authentication.
     *
     * @return \Dingo\Api\Contract\Auth\Provider
     */
    public function getProviderUsed()
    {
        return $this->providerUsed;
    }

    /**
     * Extend the authentication layer with a custom provider.
     *
     * @param string          $key
     * @param object|callable $provider
     *
     * @return void
     */
    public function extend($key, $provider)
    {
        if (is_callable($provider)) {
            $provider = call_user_func($provider, $this->container);
        }

        $this->providers[$key] = $provider;
    }
}


================================================
FILE: src/Auth/Provider/Authorization.php
================================================
<?php

namespace Dingo\Api\Auth\Provider;

use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

abstract class Authorization implements \Dingo\Api\Contract\Auth\Provider
{
    /**
     * Array of provider specific options.
     *
     * @var array
     */
    protected $options = [];

    /**
     * Validate the requests authorization header for the provider.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
     *
     * @return bool
     */
    public function validateAuthorizationHeader(Request $request)
    {
        if (Str::startsWith(strtolower($request->headers->get('authorization')), $this->getAuthorizationMethod())) {
            return true;
        }

        throw new BadRequestHttpException;
    }

    /**
     * Get the providers authorization method.
     *
     * @return string
     */
    abstract public function getAuthorizationMethod();
}


================================================
FILE: src/Auth/Provider/Basic.php
================================================
<?php

namespace Dingo\Api\Auth\Provider;

use Dingo\Api\Routing\Route;
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;

class Basic extends Authorization
{
    /**
     * Illuminate authentication manager.
     *
     * @var \Illuminate\Auth\AuthManager
     */
    protected $auth;

    /**
     * Basic auth identifier.
     *
     * @var string
     */
    protected $identifier;

    /**
     * Create a new basic provider instance.
     *
     * @param \Illuminate\Auth\AuthManager $auth
     * @param string                       $identifier
     *
     * @return void
     */
    public function __construct(AuthManager $auth, $identifier = 'email')
    {
        $this->auth = $auth;
        $this->identifier = $identifier;
    }

    /**
     * Authenticate request with Basic.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Dingo\Api\Routing\Route $route
     *
     * @return mixed
     */
    public function authenticate(Request $request, Route $route)
    {
        $this->validateAuthorizationHeader($request);

        if (($response = $this->auth->onceBasic($this->identifier)) && $response->getStatusCode() === 401) {
            throw new UnauthorizedHttpException('Basic', 'Invalid authentication credentials.');
        }

        return $this->auth->user();
    }

    /**
     * Get the providers authorization method.
     *
     * @return string
     */
    public function getAuthorizationMethod()
    {
        return 'basic';
    }
}


================================================
FILE: src/Auth/Provider/JWT.php
================================================
<?php

namespace Dingo\Api\Auth\Provider;

use Exception;
use Tymon\JWTAuth\JWTAuth;
use Dingo\Api\Routing\Route;
use Illuminate\Http\Request;
use Tymon\JWTAuth\Exceptions\JWTException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;

class JWT extends Authorization
{
    /**
     * The JWTAuth instance.
     *
     * @var \Tymon\JWTAuth\JWTAuth
     */
    protected $auth;

    /**
     * Create a new JWT provider instance.
     *
     * @param \Tymon\JWTAuth\JWTAuth $auth
     *
     * @return void
     */
    public function __construct(JWTAuth $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Authenticate request with a JWT.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Dingo\Api\Routing\Route $route
     *
     * @return mixed
     */
    public function authenticate(Request $request, Route $route)
    {
        $token = $this->getToken($request);

        try {
            if (! $user = $this->auth->setToken($token)->authenticate()) {
                throw new UnauthorizedHttpException('JWTAuth', 'Unable to authenticate with invalid token.');
            }
        } catch (JWTException $exception) {
            throw new UnauthorizedHttpException('JWTAuth', $exception->getMessage(), $exception);
        }

        return $user;
    }

    /**
     * Get the JWT from the request.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @throws \Exception
     *
     * @return string
     */
    protected function getToken(Request $request)
    {
        try {
            $this->validateAuthorizationHeader($request);

            $token = $this->parseAuthorizationHeader($request);
        } catch (Exception $exception) {
            if (! $token = $request->query('token', false)) {
                throw $exception;
            }
        }

        return $token;
    }

    /**
     * Parse JWT from the authorization header.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return string
     */
    protected function parseAuthorizationHeader(Request $request)
    {
        return trim(str_ireplace($this->getAuthorizationMethod(), '', $request->header('authorization')));
    }

    /**
     * Get the providers authorization method.
     *
     * @return string
     */
    public function getAuthorizationMethod()
    {
        return 'bearer';
    }
}


================================================
FILE: src/Console/Command/Cache.php
================================================
<?php

namespace Dingo\Api\Console\Command;

use Dingo\Api\Routing\Router;
use Illuminate\Console\Command;
use Illuminate\Filesystem\Filesystem;
use Dingo\Api\Contract\Routing\Adapter;
use Illuminate\Contracts\Console\Kernel;

class Cache extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    public $signature = 'api:cache';

    /**
     * The console command description.
     *
     * @var string
     */
    public $description = 'Create a route cache file for faster route registration';

    /**
     * Filesystem instance.
     *
     * @var \Illuminate\Filesystem\Filesystem
     */
    protected $files;

    /**
     * Router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    private $router;

    /**
     * Adapter instance.
     *
     * @var \Dingo\Api\Contract\Routing\Adapter
     */
    private $adapter;

    /**
     * Create a new cache command instance.
     *
     * @param \Illuminate\Filesystem\Filesystem   $files
     * @param \Dingo\Api\Routing\Router           $router
     * @param \Dingo\Api\Contract\Routing\Adapter $adapter
     *
     * @return void
     */
    public function __construct(Filesystem $files, Router $router, Adapter $adapter)
    {
        $this->files = $files;
        $this->router = $router;
        $this->adapter = $adapter;

        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->callSilent('route:clear');

        $app = $this->getFreshApplication();

        $this->call('route:cache');

        $routes = $app['api.router']->getAdapterRoutes();

        foreach ($routes as $collection) {
            foreach ($collection as $route) {
                $app['api.router.adapter']->prepareRouteForSerialization($route);
            }
        }

        $stub = "app('api.router')->setAdapterRoutes(unserialize(base64_decode('{{routes}}')));";
        $path = $this->laravel->getCachedRoutesPath();

        if (! $this->files->exists($path)) {
            $stub = "<?php\n\n$stub";
        }

        $this->files->append(
            $path,
            str_replace('{{routes}}', base64_encode(serialize($routes)), $stub)
        );
    }

    /**
     * Get a fresh application instance.
     *
     * @return \Illuminate\Contracts\Container\Container
     */
    protected function getFreshApplication()
    {
        if (method_exists($this->laravel, 'bootstrapPath')) {
            $app = require $this->laravel->bootstrapPath().'/app.php';
        } else {
            $app = require $this->laravel->basePath().'/bootstrap/app.php';
        }

        $app->make(Kernel::class)->bootstrap();

        return $app;
    }
}


================================================
FILE: src/Console/Command/Docs.php
================================================
<?php

namespace Dingo\Api\Console\Command;

use ReflectionClass;
use Dingo\Blueprint\Writer;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Dingo\Api\Routing\Router;
use Dingo\Blueprint\Blueprint;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;

class Docs extends Command
{
    /**
     * Router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * The blueprint instance.
     *
     * @var \Dingo\Blueprint\Blueprint
     */
    protected $blueprint;

    /**
     * Blueprint instance.
     *
     * @var \Dingo\Blueprint\Blueprint
     */
    protected $docs;

    /**
     * Writer instance.
     *
     * @var \Dingo\Blueprint\Writer
     */
    protected $writer;

    /**
     * Default documentation name.
     *
     * @var string
     */
    protected $name;

    /**
     * Default documentation version.
     *
     * @var string
     */
    protected $version;

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'api:docs {--name= : Name of the generated documentation}
                                     {--use-version= : Version of the documentation to be generated}
                                     {--output-file= : Output the generated documentation to a file}
                                     {--include-path= : Path where included documentation files are located}
                                     {--use-controller= : Specify a controller where to generate documentation for}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Generate API documentation from annotated controllers';

    /**
     * Create a new docs command instance.
     *
     * @param \Dingo\Api\Routing\Router  $router
     * @param \Dingo\Blueprint\Blueprint $blueprint
     * @param \Dingo\Blueprint\Writer    $writer
     * @param string                     $name
     * @param string                     $version
     *
     * @return void
     */
    public function __construct(Router $router, Blueprint $blueprint, Writer $writer, $name, $version)
    {
        parent::__construct();

        $this->router = $router;
        $this->blueprint = $blueprint;
        $this->writer = $writer;
        $this->name = $name;
        $this->version = $version;
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $contents = $this->blueprint->generate($this->getControllers(), $this->getDocName(), $this->getVersion(), $this->getIncludePath());

        if ($file = $this->option('output-file')) {
            $this->writer->write($contents, $file);

            return $this->info('Documentation was generated successfully.');
        }

        return $this->line($contents);
    }

    /**
     * Get the documentation name.
     *
     * @return string
     */
    protected function getDocName()
    {
        $name = $this->option('name') ?: $this->name;

        if (! $name) {
            $this->comment('A name for the documentation was not supplied. Use the --name option or set a default in the configuration.');

            exit;
        }

        return $name;
    }

    /**
     * Get the include path for documentation files.
     *
     * @return string
     */
    protected function getIncludePath()
    {
        return base_path($this->option('include-path'));
    }

    /**
     * Get the documentation version.
     *
     * @return string
     */
    protected function getVersion()
    {
        $version = $this->option('use-version') ?: $this->version;

        if (! $version) {
            $this->comment('A version for the documentation was not supplied. Use the --use-version option or set a default in the configuration.');

            exit;
        }

        return $version;
    }

    /**
     * Get all the controller instances.
     *
     * @return array
     */
    protected function getControllers()
    {
        $controllers = new Collection;

        if ($controller = $this->option('use-controller')) {
            $this->addControllerIfNotExists($controllers, app($controller));

            return $controllers;
        }

        foreach ($this->router->getRoutes() as $collections) {
            foreach ($collections as $route) {
                if ($controller = $route->getControllerInstance()) {
                    $this->addControllerIfNotExists($controllers, $controller);
                }
            }
        }

        return $controllers;
    }

    /**
     * Add a controller to the collection if it does not exist. If the
     * controller implements an interface suffixed with "Docs" it
     * will be used instead of the controller.
     *
     * @param \Illuminate\Support\Collection $controllers
     * @param object                         $controller
     *
     * @return void
     */
    protected function addControllerIfNotExists(Collection $controllers, $controller)
    {
        $class = get_class($controller);

        if ($controllers->has($class)) {
            return;
        }

        $reflection = new ReflectionClass($controller);

        $interface = Arr::first($reflection->getInterfaces(), function ($key, $value) {
            return Str::endsWith($key, 'Docs');
        });

        if ($interface) {
            $controller = $interface;
        }

        $controllers->put($class, $controller);
    }
}


================================================
FILE: src/Console/Command/Routes.php
================================================
<?php

namespace Dingo\Api\Console\Command;

use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use Dingo\Api\Routing\Router;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Illuminate\Foundation\Console\RouteListCommand;

class Routes extends RouteListCommand
{
    /**
     * Dingo router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * Array of route collections.
     *
     * @var array
     */
    protected $routes;

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = 'api:routes';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'List all registered API routes';

    /**
     * The table headers for the command.
     *
     * @var array
     */
    protected $headers = ['Host', 'Method', 'URI', 'Name', 'Action', 'Protected', 'Version(s)', 'Scope(s)', 'Rate Limit'];

    /**
     * Create a new routes command instance.
     *
     * @param \Dingo\Api\Routing\Router $router
     *
     * @return void
     */
    public function __construct(Router $router)
    {
        // Ugly, but we need to bypass the constructor and directly target the
        // constructor on the command class.
        Command::__construct();

        $this->router = $router;
    }

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function fire()
    {
        $this->routes = $this->router->getRoutes();

        parent::fire();
    }

    /**
     * Execute the console command.
     *
     * @return void
     */
    public function handle()
    {
        $this->routes = $this->router->getRoutes();

        parent::handle();
    }

    /**
     * Compile the routes into a displayable format.
     *
     * @return array
     */
    protected function getRoutes()
    {
        $routes = [];

        foreach ($this->router->getRoutes() as $collection) {
            foreach ($collection->getRoutes() as $route) {
                $routes[] = $this->filterRoute([
                    'host' => $route->domain(),
                    'method' => implode('|', $route->methods()),
                    'uri' => $route->uri(),
                    'name' => $route->getName(),
                    'action' => $route->getActionName(),
                    'protected' => $route->isProtected() ? 'Yes' : 'No',
                    'versions' => implode(', ', $route->versions()),
                    'scopes' => implode(', ', $route->scopes()),
                    'rate' => $this->routeRateLimit($route),
                ]);
            }
        }

        if ($sort = $this->option('sort')) {
            $routes = Arr::sort($routes, function ($value) use ($sort) {
                return $value[$sort];
            });
        }

        if ($this->option('reverse')) {
            $routes = array_reverse($routes);
        }

        if ($this->option('short')) {
            $this->headers = ['Method', 'URI', 'Name', 'Version(s)'];

            $routes = array_map(function ($item) {
                return Arr::only($item, ['method', 'uri', 'name', 'versions']);
            }, $routes);
        }

        return array_filter(array_unique($routes, SORT_REGULAR));
    }

    /**
     * Display the routes rate limiting requests per second. This takes the limit
     * and divides it by the expiration time in seconds to give you a rough
     * idea of how many requests you'd be able to fire off per second
     * on the route.
     *
     * @param \Dingo\Api\Routing\Route $route
     *
     * @return null|string
     */
    protected function routeRateLimit($route)
    {
        [$limit, $expires] = [$route->getRateLimit(), $route->getRateLimitExpiration()];

        if ($limit && $expires) {
            return sprintf('%s req/s', round($limit / ($expires * 60), 2));
        }
    }

    /**
     * Filter the route by URI, Version, Scopes and / or name.
     *
     * @param array $route
     *
     * @return array|null
     */
    protected function filterRoute(array $route)
    {
        $filters = ['name', 'path', 'protected', 'unprotected', 'versions', 'scopes'];

        foreach ($filters as $filter) {
            if ($this->option($filter) && ! $this->{'filterBy'.ucfirst($filter)}($route)) {
                return;
            }
        }

        return $route;
    }

    /**
     * Get the console command options.
     *
     * @return array
     */
    protected function getOptions()
    {
        $options = parent::getOptions();

        foreach ($options as $key => $option) {
            if ($option[0] == 'sort') {
                unset($options[$key]);
            }
        }

        return array_merge(
            $options,
            [
                ['sort', null, InputOption::VALUE_OPTIONAL, 'The column (domain, method, uri, name, action) to sort by'],
                ['versions', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Filter the routes by version'],
                ['scopes', 'S', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, 'Filter the routes by scopes'],
                ['protected', null, InputOption::VALUE_NONE, 'Filter the protected routes'],
                ['unprotected', null, InputOption::VALUE_NONE, 'Filter the unprotected routes'],
                ['short', null, InputOption::VALUE_NONE, 'Get an abridged version of the routes'],
            ]
        );
    }

    /**
     * Filter the route by its path.
     *
     * @param array $route
     *
     * @return bool
     */
    protected function filterByPath(array $route)
    {
        return Str::contains($route['uri'], $this->option('path'));
    }

    /**
     * Filter the route by whether or not it is protected.
     *
     * @param array $route
     *
     * @return bool
     */
    protected function filterByProtected(array $route)
    {
        return $this->option('protected') && $route['protected'] == 'Yes';
    }

    /**
     * Filter the route by whether or not it is unprotected.
     *
     * @param array $route
     *
     * @return bool
     */
    protected function filterByUnprotected(array $route)
    {
        return $this->option('unprotected') && $route['protected'] == 'No';
    }

    /**
     * Filter the route by its versions.
     *
     * @param array $route
     *
     * @return bool
     */
    protected function filterByVersions(array $route)
    {
        foreach ($this->option('versions') as $version) {
            if (Str::contains($route['versions'], $version)) {
                return true;
            }
        }

        return false;
    }

    /**
     * Filter the route by its name.
     *
     * @param array $route
     *
     * @return bool
     */
    protected function filterByName(array $route)
    {
        return Str::contains($route['name'], $this->option('name'));
    }

    /**
     * Filter the route by its scopes.
     *
     * @param array $route
     *
     * @return bool
     */
    protected function filterByScopes(array $route)
    {
        foreach ($this->option('scopes') as $scope) {
            if (Str::contains($route['scopes'], $scope)) {
                return true;
            }
        }

        return false;
    }
}


================================================
FILE: src/Contract/Auth/Provider.php
================================================
<?php

namespace Dingo\Api\Contract\Auth;

use Dingo\Api\Routing\Route;
use Illuminate\Http\Request;

interface Provider
{
    /**
     * Authenticate the request and return the authenticated user instance.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Dingo\Api\Routing\Route $route
     *
     * @return mixed
     */
    public function authenticate(Request $request, Route $route);
}


================================================
FILE: src/Contract/Debug/ExceptionHandler.php
================================================
<?php

namespace Dingo\Api\Contract\Debug;

interface ExceptionHandler
{
    /**
     * Handle an exception.
     *
     * @param \Throwable|\Exception $exception
     *
     * @return \Illuminate\Http\Response
     */
    public function handle($exception);
}


================================================
FILE: src/Contract/Debug/MessageBagErrors.php
================================================
<?php

namespace Dingo\Api\Contract\Debug;

interface MessageBagErrors
{
    /**
     * Get the errors message bag.
     *
     * @return \Illuminate\Support\MessageBag
     */
    public function getErrors();

    /**
     * Determine if message bag has any errors.
     *
     * @return bool
     */
    public function hasErrors();
}


================================================
FILE: src/Contract/Http/Parser.php
================================================
<?php

namespace Dingo\Api\Contract\Http;

use Illuminate\Http\Request as IlluminateRequest;

interface Parser
{
    /**
     * Parse an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return mixed
     */
    public function parse(IlluminateRequest $request);
}


================================================
FILE: src/Contract/Http/RateLimit/HasRateLimiter.php
================================================
<?php

namespace Dingo\Api\Contract\Http\RateLimit;

use Dingo\Api\Http\Request;
use Illuminate\Container\Container;

interface HasRateLimiter
{
    /**
     * Get rate limiter callable.
     *
     * @param \Illuminate\Container\Container $app
     * @param \Dingo\Api\Http\Request         $request
     *
     * @return string
     */
    public function getRateLimiter(Container $app, Request $request);
}


================================================
FILE: src/Contract/Http/RateLimit/Throttle.php
================================================
<?php

namespace Dingo\Api\Contract\Http\RateLimit;

use Illuminate\Container\Container;

interface Throttle
{
    /**
     * Attempt to match the throttle against a given condition.
     *
     * @param \Illuminate\Container\Container $container
     *
     * @return bool
     */
    public function match(Container $container);

    /**
     * Get the time in minutes that the throttles request limit will expire.
     *
     * @return int
     */
    public function getExpires();

    /**
     * Get the throttles request limit.
     *
     * @return int
     */
    public function getLimit();
}


================================================
FILE: src/Contract/Http/Request.php
================================================
<?php

namespace Dingo\Api\Contract\Http;

use Illuminate\Http\Request as IlluminateRequest;

interface Request
{
    /**
     * Create a new Dingo request instance from an Illuminate request instance.
     *
     * @param \Illuminate\Http\Request $old
     *
     * @return \Dingo\Api\Http\Request
     */
    public function createFromIlluminate(IlluminateRequest $old);
}


================================================
FILE: src/Contract/Http/Validator.php
================================================
<?php

namespace Dingo\Api\Contract\Http;

use Illuminate\Http\Request as IlluminateRequest;

interface Validator
{
    /**
     * Validate a request.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return bool
     */
    public function validate(IlluminateRequest $request);
}


================================================
FILE: src/Contract/Routing/Adapter.php
================================================
<?php

namespace Dingo\Api\Contract\Routing;

use Illuminate\Http\Request;

interface Adapter
{
    /**
     * Dispatch a request.
     *
     * @param \Illuminate\Http\Request $request
     * @param string                   $version
     *
     * @return mixed
     */
    public function dispatch(Request $request, $version);

    /**
     * Get the URI, methods, and action from the route.
     *
     * @param mixed                    $route
     * @param \Illuminate\Http\Request $request
     *
     * @return array
     */
    public function getRouteProperties($route, Request $request);

    /**
     * Add a route to the appropriate route collection.
     *
     * @param array  $methods
     * @param array  $versions
     * @param string $uri
     * @param mixed  $action
     *
     * @return void
     */
    public function addRoute(array $methods, array $versions, $uri, $action);

    /**
     * Get all routes or only for a specific version.
     *
     * @param string $version
     *
     * @return mixed
     */
    public function getRoutes($version = null);

    /**
     * Get a normalized iterable set of routes. Top level key must be a version with each
     * version containing iterable routes that can be consumed by the adapter.
     *
     * @param string $version
     *
     * @return mixed
     */
    public function getIterableRoutes($version = null);

    /**
     * Set the routes on the adapter.
     *
     * @param array $routes
     *
     * @return void
     */
    public function setRoutes(array $routes);

    /**
     * Prepare a route for serialization.
     *
     * @param mixed $route
     *
     * @return mixed
     */
    public function prepareRouteForSerialization($route);
}


================================================
FILE: src/Contract/Transformer/Adapter.php
================================================
<?php

namespace Dingo\Api\Contract\Transformer;

use Dingo\Api\Http\Request;
use Dingo\Api\Transformer\Binding;

interface Adapter
{
    /**
     * Transform a response with a transformer.
     *
     * @param mixed                          $response
     * @param object                         $transformer
     * @param \Dingo\Api\Transformer\Binding $binding
     * @param \Dingo\Api\Http\Request        $request
     *
     * @return array
     */
    public function transform($response, $transformer, Binding $binding, Request $request);
}


================================================
FILE: src/Dispatcher.php
================================================
<?php

namespace Dingo\Api;

use Dingo\Api\Auth\Auth;
use Illuminate\Support\Str;
use Dingo\Api\Routing\Router;
use Dingo\Api\Http\InternalRequest;
use Illuminate\Container\Container;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\Cookie;
use Dingo\Api\Exception\InternalHttpException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Illuminate\Support\Facades\Request as RequestFacade;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

class Dispatcher
{
    /**
     * Illuminate container instance.
     *
     * @var \Illuminate\Container\Container
     */
    protected $container;

    /**
     * Illuminate filesystem instance.
     *
     * @var \Illuminate\Filesystem\Filesystem
     */
    protected $files;

    /**
     * Router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * Auth instance.
     *
     * @var \Dingo\Api\Auth\Auth
     */
    protected $auth;

    /**
     * Internal request stack.
     *
     * @var array
     */
    protected $requestStack = [];

    /**
     * Internal route stack.
     *
     * @var array
     */
    protected $routeStack = [];

    /**
     * Version for the request.
     *
     * @var string
     */
    protected $version;

    /**
     * Request headers.
     *
     * @var array
     */
    protected $headers = [];

    /**
     * Request cookies.
     *
     * @var array
     */
    protected $cookies = [];

    /**
     * Request parameters.
     *
     * @var array
     */
    protected $parameters = [];

    /**
     * Request raw content.
     *
     * @var string
     */
    protected $content;

    /**
     * Request uploaded files.
     *
     * @var array
     */
    protected $uploads = [];

    /**
     * Domain for the request.
     *
     * @var string
     */
    protected $domain;

    /**
     * Indicates whether the returned response is the raw response object.
     *
     * @var bool
     */
    protected $raw = false;

    /**
     * Indicates whether authentication is persisted.
     *
     * @var bool
     */
    protected $persistAuthentication = true;

    /**
     * API subtype.
     *
     * @var string
     */
    protected $subtype;

    /**
     * API standards tree.
     *
     * @var string
     */
    protected $standardsTree;

    /**
     * API prefix.
     *
     * @var string
     */
    protected $prefix;

    /**
     * Default version.
     *
     * @var string
     */
    protected $defaultVersion;

    /**
     * Default domain.
     *
     * @var string
     */
    protected $defaultDomain;

    /**
     * Default format.
     *
     * @var string
     */
    protected $defaultFormat;

    /**
     * Create a new dispatcher instance.
     *
     * @param \Illuminate\Container\Container   $container
     * @param \Illuminate\Filesystem\Filesystem $files
     * @param \Dingo\Api\Routing\Router         $router
     * @param \Dingo\Api\Auth\Auth              $auth
     *
     * @return void
     */
    public function __construct(Container $container, Filesystem $files, Router $router, Auth $auth)
    {
        $this->container = $container;
        $this->files = $files;
        $this->router = $router;
        $this->auth = $auth;

        $this->setupRequestStack();
    }

    /**
     * Setup the request stack by grabbing the initial request.
     *
     * @return void
     */
    protected function setupRequestStack()
    {
        $this->requestStack[] = $this->container['request'];
    }

    /**
     * Attach files to be uploaded.
     *
     * @param array $files
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function attach(array $files)
    {
        foreach ($files as $key => $file) {
            if (is_array($file)) {
                $file = new UploadedFile($file['path'], basename($file['path']), $file['mime'], $file['size']);
            } elseif (is_string($file)) {
                $finfo = finfo_open(FILEINFO_MIME_TYPE);

                $file = new UploadedFile($file, basename($file), finfo_file($finfo, $file), $this->files->size($file));
            } elseif (! $file instanceof UploadedFile) {
                continue;
            }

            $this->uploads[$key] = $file;
        }

        return $this;
    }

    /**
     * Internal request will be authenticated as the given user.
     *
     * @param mixed $user
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function be($user)
    {
        $this->auth->setUser($user);

        return $this;
    }

    /**
     * Send a JSON payload in the request body.
     *
     * @param string|array $content
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function json($content)
    {
        if (is_array($content)) {
            $content = json_encode($content);
        }

        $this->content = $content;

        return $this->header('Content-Type', 'application/json');
    }

    /**
     * Sets the domain to be used for the request.
     *
     * @param string $domain
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function on($domain)
    {
        $this->domain = $domain;

        return $this;
    }

    /**
     * Return the raw response object once request is dispatched.
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function raw()
    {
        $this->raw = true;

        return $this;
    }

    /**
     * Only authenticate with the given user for a single request.
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function once()
    {
        $this->persistAuthentication = false;

        return $this;
    }

    /**
     * Set the version of the API for the next request.
     *
     * @param string $version
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function version($version)
    {
        $this->version = $version;

        return $this;
    }

    /**
     * Set the parameters to be sent on the next API request.
     *
     * @param string|array $parameters
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function with($parameters)
    {
        $this->parameters = array_merge($this->parameters, is_array($parameters) ? $parameters : func_get_args());

        return $this;
    }

    /**
     * Set a header to be sent on the next API request.
     *
     * @param string $key
     * @param string $value
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function header($key, $value)
    {
        $this->headers[$key] = $value;

        return $this;
    }

    /**
     * Set a cookie to be sent on the next API request.
     *
     * @param \Symfony\Component\HttpFoundation\Cookie $cookie
     *
     * @return \Dingo\Api\Dispatcher
     */
    public function cookie(Cookie $cookie)
    {
        $this->cookies[] = $cookie;

        return $this;
    }

    /**
     * Perform API GET request.
     *
     * @param string       $uri
     * @param string|array $parameters
     *
     * @return mixed
     */
    public function get($uri, $parameters = [])
    {
        return $this->queueRequest('get', $uri, $parameters);
    }

    /**
     * Perform API POST request.
     *
     * @param string       $uri
     * @param string|array $parameters
     * @param string       $content
     *
     * @return mixed
     */
    public function post($uri, $parameters = [], $content = '')
    {
        return $this->queueRequest('post', $uri, $parameters, $content);
    }

    /**
     * Perform API PUT request.
     *
     * @param string       $uri
     * @param string|array $parameters
     * @param string       $content
     *
     * @return mixed
     */
    public function put($uri, $parameters = [], $content = '')
    {
        return $this->queueRequest('put', $uri, $parameters, $content);
    }

    /**
     * Perform API PATCH request.
     *
     * @param string       $uri
     * @param string|array $parameters
     * @param string       $content
     *
     * @return mixed
     */
    public function patch($uri, $parameters = [], $content = '')
    {
        return $this->queueRequest('patch', $uri, $parameters, $content);
    }

    /**
     * Perform API DELETE request.
     *
     * @param string       $uri
     * @param string|array $parameters
     * @param string       $content
     *
     * @return mixed
     */
    public function delete($uri, $parameters = [], $content = '')
    {
        return $this->queueRequest('delete', $uri, $parameters, $content);
    }

    /**
     * Queue up and dispatch a new request.
     *
     * @param string       $verb
     * @param string       $uri
     * @param string|array $parameters
     * @param string       $content
     *
     * @return mixed
     */
    protected function queueRequest($verb, $uri, $parameters, $content = '')
    {
        if (! empty($content)) {
            $this->content = $content;
        }

        // Sometimes after setting the initial request another request might be made prior to
        // internally dispatching an API request. We need to capture this request as well
        // and add it to the request stack as it has become the new parent request to
        // this internal request. This will generally occur during tests when
        // using the crawler to navigate pages that also make internal
        // requests.
        if (end($this->requestStack) != $this->container['request']) {
            $this->requestStack[] = $this->container['request'];
        }

        $this->requestStack[] = $request = $this->createRequest($verb, $uri, $parameters);

        return $this->dispatch($request);
    }

    /**
     * Create a new internal request from an HTTP verb and URI.
     *
     * @param string       $verb
     * @param string       $uri
     * @param string|array $parameters
     *
     * @return \Dingo\Api\Http\InternalRequest
     */
    protected function createRequest($verb, $uri, $parameters)
    {
        $parameters = array_merge($this->parameters, (array) $parameters);

        $uri = $this->addPrefixToUri($uri);

        // If the URI does not have a scheme then we can assume that there it is not an
        // absolute URI, in this case we'll prefix the root requests path to the URI.
        $rootUrl = $this->getRootRequest()->root();
        if ((! parse_url($uri, PHP_URL_SCHEME)) && parse_url($rootUrl) !== false) {
            $uri = rtrim($rootUrl, '/').'/'.ltrim($uri, '/');
        }

        $request = InternalRequest::create(
            $uri,
            $verb,
            $parameters,
            $this->cookies,
            $this->uploads,
            $this->container['request']->server->all(),
            $this->content
        );

        $request->headers->set('host', $this->getDomain());

        foreach ($this->headers as $header => $value) {
            $request->headers->set($header, $value);
        }

        $request->headers->set('accept', $this->getAcceptHeader());

        return $request;
    }

    /**
     * Add the prefix to the URI.
     *
     * @param string $uri
     *
     * @return string
     */
    protected function addPrefixToUri($uri)
    {
        if (! isset($this->prefix)) {
            return $uri;
        }

        $uri = trim($uri, '/');

        if (Str::startsWith($uri, $this->prefix)) {
            return $uri;
        }

        return rtrim('/'.trim($this->prefix, '/').'/'.$uri, '/');
    }

    /**
     * Build the "Accept" header.
     *
     * @return string
     */
    protected function getAcceptHeader()
    {
        return sprintf('application/%s.%s.%s+%s', $this->getStandardsTree(), $this->getSubtype(), $this->getVersion(), $this->getFormat());
    }

    /**
     * Attempt to dispatch an internal request.
     *
     * @param \Dingo\Api\Http\InternalRequest $request
     *
     * @throws \Exception|\Symfony\Component\HttpKernel\Exception\HttpExceptionInterface
     *
     * @return mixed
     */
    protected function dispatch(InternalRequest $request)
    {
        $this->routeStack[] = $this->router->getCurrentRoute();

        $this->clearCachedFacadeInstance();

        try {
            $this->container->instance('request', $request);

            $response = $this->router->dispatch($request);

            if (! $response->isSuccessful() && ! $response->isRedirection()) {
                throw new InternalHttpException($response);
            }

            if (! $this->raw) {
                $response = $response->getOriginalContent();
            }
        } catch (HttpExceptionInterface $exception) {
            $this->refreshRequestStack();

            throw $exception;
        }

        $this->refreshRequestStack();

        return $response;
    }

    /**
     * Refresh the request stack.
     *
     * This is done by resetting the authentication, popping
     * the last request from the stack, replacing the input,
     * and resetting the version and parameters.
     *
     * @return void
     */
    protected function refreshRequestStack()
    {
        if (! $this->persistAuthentication) {
            $this->auth->setUser(null);

            $this->persistAuthentication = true;
        }

        if ($route = array_pop($this->routeStack)) {
            $this->router->setCurrentRoute($route);
        }

        $this->replaceRequestInstance();

        $this->clearCachedFacadeInstance();

        $this->raw = false;

        $this->version = $this->domain = $this->content = null;

        $this->parameters = $this->uploads = [];
    }

    /**
     * Replace the request instance with the previous request instance.
     *
     * @return void
     */
    protected function replaceRequestInstance()
    {
        array_pop($this->requestStack);

        $this->container->instance('request', end($this->requestStack));
    }

    /**
     * Clear the cached facade instance.
     *
     * @return void
     */
    protected function clearCachedFacadeInstance()
    {
        // Facades cache the resolved instance so we need to clear out the
        // request instance that may have been cached. Otherwise we'll
        // may get unexpected results.
        RequestFacade::clearResolvedInstance('request');
    }

    /**
     * Get the root request instance.
     *
     * @return \Illuminate\Http\Request
     */
    protected function getRootRequest()
    {
        return reset($this->requestStack);
    }

    /**
     * Get the domain.
     *
     * @return string
     */
    public function getDomain()
    {
        return $this->domain ?: $this->defaultDomain;
    }

    /**
     * Get the version.
     *
     * @return string
     */
    public function getVersion()
    {
        return $this->version ?: $this->defaultVersion;
    }

    /**
     * Get the format.
     *
     * @return string
     */
    public function getFormat()
    {
        return $this->defaultFormat;
    }

    /**
     * Get the subtype.
     *
     * @return string
     */
    public function getSubtype()
    {
        return $this->subtype;
    }

    /**
     * Set the subtype.
     *
     * @param string $subtype
     *
     * @return void
     */
    public function setSubtype($subtype)
    {
        $this->subtype = $subtype;
    }

    /**
     * Get the standards tree.
     *
     * @return string
     */
    public function getStandardsTree()
    {
        return $this->standardsTree;
    }

    /**
     * Set the standards tree.
     *
     * @param string $standardsTree
     *
     * @return void
     */
    public function setStandardsTree($standardsTree)
    {
        $this->standardsTree = $standardsTree;
    }

    /**
     * Set the prefix.
     *
     * @param string $prefix
     *
     * @return void
     */
    public function setPrefix($prefix)
    {
        $this->prefix = $prefix;
    }

    /**
     * Set the default version.
     *
     * @param string $version
     *
     * @return void
     */
    public function setDefaultVersion($version)
    {
        $this->defaultVersion = $version;
    }

    /**
     * Set the default domain.
     *
     * @param string $domain
     *
     * @return void
     */
    public function setDefaultDomain($domain)
    {
        $this->defaultDomain = $domain;
    }

    /**
     * Set the default format.
     *
     * @param string $format
     *
     * @return void
     */
    public function setDefaultFormat($format)
    {
        $this->defaultFormat = $format;
    }
}


================================================
FILE: src/Event/RequestWasMatched.php
================================================
<?php

namespace Dingo\Api\Event;

use Dingo\Api\Http\Request;
use Illuminate\Contracts\Container\Container;

class RequestWasMatched
{
    /**
     * Request instance.
     *
     * @var \Dingo\Api\Http\Request
     */
    public $request;

    /**
     * Application instance.
     *
     * @var \Illuminate\Contracts\Container\Container
     */
    public $app;

    /**
     * Create a new request was matched event.
     *
     * @param \Dingo\Api\Http\Request                   $request
     * @param \Illuminate\Contracts\Container\Container $app
     *
     * @return void
     */
    public function __construct(Request $request, Container $app)
    {
        $this->request = $request;
        $this->app = $app;
    }
}


================================================
FILE: src/Event/ResponseIsMorphing.php
================================================
<?php

namespace Dingo\Api\Event;

use Dingo\Api\Http\Response;

class ResponseIsMorphing
{
    /**
     * Response instance.
     *
     * @var \Dingo\Api\Http\Response
     */
    public $response;

    /**
     * Response content.
     *
     * @var string
     */
    public $content;

    /**
     * Create a new response is morphing event. Content is passed by reference
     * so that multiple listeners can modify content.
     *
     * @param \Dingo\Api\Http\Response $response
     * @param string                   $content
     *
     * @return void
     */
    public function __construct(Response $response, &$content)
    {
        $this->response = $response;
        $this->content = &$content;
    }
}


================================================
FILE: src/Event/ResponseWasMorphed.php
================================================
<?php

namespace Dingo\Api\Event;

class ResponseWasMorphed extends ResponseIsMorphing
{
    //
}


================================================
FILE: src/Exception/DeleteResourceFailedException.php
================================================
<?php

namespace Dingo\Api\Exception;

class DeleteResourceFailedException extends ResourceException
{
    //
}


================================================
FILE: src/Exception/Handler.php
================================================
<?php

namespace Dingo\Api\Exception;

use Dingo\Api\Http\Request;
use Exception;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Support\Str;
use Illuminate\Http\Response;
use Dingo\Api\Contract\Debug\ExceptionHandler;
use Dingo\Api\Contract\Debug\MessageBagErrors;
use Illuminate\Contracts\Debug\ExceptionHandler as IlluminateExceptionHandler;
use Illuminate\Validation\ValidationException;
use ReflectionFunction;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpFoundation\Response as BaseResponse;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;

class Handler implements ExceptionHandler, IlluminateExceptionHandler
{
    /**
     * Array of exception handlers.
     *
     * @var array
     */
    protected $handlers = [];

    /**
     * Generic response format.
     *
     * @var array
     */
    protected $format;

    /**
     * Indicates if we are in debug mode.
     *
     * @var bool
     */
    protected $debug = false;

    /**
     * User defined replacements to merge with defaults.
     *
     * @var array
     */
    protected $replacements = [];

    /**
     * The parent Illuminate exception handler instance.
     *
     * @var IlluminateExceptionHandler
     */
    protected $parentHandler;

    /**
     * Create a new exception handler instance.
     *
     * @param IlluminateExceptionHandler $parentHandler
     * @param array                                        $format
     * @param bool                                         $debug
     *
     * @return void
     */
    public function __construct(IlluminateExceptionHandler $parentHandler, array $format, $debug)
    {
        $this->parentHandler = $parentHandler;
        $this->format = $format;
        $this->debug = $debug;
    }

    /**
     * Report or log an exception.
     *
     * @param Throwable $exception
     *
     * @return void
     */
    public function report(Throwable $throwable)
    {
        $this->parentHandler->report($throwable);
    }

    /**
     * Determine if the exception should be reported.
     *
     * @param Throwable $e
     *
     * @return bool
     */
    public function shouldReport(Throwable $e)
    {
        return true;
    }

    /**
     * Render an exception into an HTTP response.
     *
     * @param Request $request
     * @param Throwable $exception
     *
     * @throws Exception
     *
     * @return mixed
     */
    public function render($request, Throwable $exception)
    {
        return $this->handle($exception);
    }

    /**
     * Render an exception to the console.
     *
     * @param OutputInterface $output
     * @param Throwable $exception
     *
     * @return mixed
     */
    public function renderForConsole($output, Throwable $exception)
    {
        return $this->parentHandler->renderForConsole($output, $exception);
    }

    /**
     * Register a new exception handler.
     *
     * @param callable $callback
     *
     * @return void
     */
    public function register(callable $callback)
    {
        $hint = $this->handlerHint($callback);

        $this->handlers[$hint] = $callback;
    }

    /**
     * Handle an exception if it has an existing handler.
     *
     * @param Throwable|Exception $exception
     *
     * @return Response
     */
    public function handle($exception)
    {
        // Convert Eloquent's 500 ModelNotFoundException into a 404 NotFoundHttpException
        if ($exception instanceof ModelNotFoundException) {
            $exception = new NotFoundHttpException($exception->getMessage(), $exception);
        }

        foreach ($this->handlers as $hint => $handler) {
            if (! $exception instanceof $hint) {
                continue;
            }

            if ($response = $handler($exception)) {
                if (! $response instanceof BaseResponse) {
                    $response = new Response($response, $this->getExceptionStatusCode($exception));
                }

                return $response->withException($exception);
            }
        }

        return $this->genericResponse($exception)->withException($exception);
    }

    /**
     * Handle a generic error response if there is no handler available.
     *
     * @param Throwable $exception
     *
     * @throws Throwable
     *
     * @return Response
     */
    protected function genericResponse(Throwable $exception)
    {
        $replacements = $this->prepareReplacements($exception);

        $response = $this->newResponseArray();

        array_walk_recursive($response, function (&$value, $key) use ($replacements) {
            if (Str::startsWith($value, ':') && isset($replacements[$value])) {
                $value = $replacements[$value];
            }
        });

        $response = $this->recursivelyRemoveEmptyReplacements($response);

        return new Response($response, $this->getStatusCode($exception), $this->getHeaders($exception));
    }

    /**
     * Get the status code from the exception.
     *
     * @param Throwable $exception
     *
     * @return int
     */
    protected function getStatusCode(Throwable $exception)
    {
        $statusCode = null;

        if ($exception instanceof ValidationException) {
            $statusCode = $exception->status;
        } elseif ($exception instanceof HttpExceptionInterface) {
            $statusCode = $exception->getStatusCode();
        } else {
            // By default throw 500
            $statusCode = 500;
        }

        // Be extra defensive
        if ($statusCode < 100 || $statusCode > 599) {
            $statusCode = 500;
        }

        return $statusCode;
    }

    /**
     * Get the headers from the exception.
     *
     * @param Throwable $exception
     *
     * @return array
     */
    protected function getHeaders(Throwable $exception)
    {
        return $exception instanceof HttpExceptionInterface ? $exception->getHeaders() : [];
    }

    /**
     * Prepare the replacements array by gathering the keys and values.
     *
     * @param Throwable $exception
     *
     * @return array
     */
    protected function prepareReplacements(Throwable $exception)
    {
        $statusCode = $this->getStatusCode($exception);

        if (! $message = $exception->getMessage()) {
            $message = sprintf('%d %s', $statusCode, Response::$statusTexts[$statusCode]);
        }

        $replacements = [
            ':message' => $message,
            ':status_code' => $statusCode,
        ];

        if ($exception instanceof MessageBagErrors && $exception->hasErrors()) {
            $replacements[':errors'] = $exception->getErrors();
        }

        if ($exception instanceof ValidationException) {
            $replacements[':errors'] = $exception->errors();
            $replacements[':status_code'] = $exception->status;
        }

        if ($code = $exception->getCode()) {
            $replacements[':code'] = $code;
        }

        if ($this->runningInDebugMode()) {
            $replacements[':debug'] = [
                'line' => $exception->getLine(),
                'file' => $exception->getFile(),
                'class' => get_class($exception),
                'trace' => explode("\n", $exception->getTraceAsString()),
            ];

            // Attach trace of previous exception, if exists
            if (! is_null($exception->getPrevious())) {
                $currentTrace = $replacements[':debug']['trace'];

                $replacements[':debug']['trace'] = [
                    'previous' => explode("\n", $exception->getPrevious()->getTraceAsString()),
                    'current' => $currentTrace,
                ];
            }
        }

        return array_merge($replacements, $this->replacements);
    }

    /**
     * Set user defined replacements.
     *
     * @param array $replacements
     *
     * @return void
     */
    public function setReplacements(array $replacements)
    {
        $this->replacements = $replacements;
    }

    /**
     * Recursively remove any empty replacement values in the response array.
     *
     * @param array $input
     *
     * @return array
     */
    protected function recursivelyRemoveEmptyReplacements(array $input)
    {
        foreach ($input as &$value) {
            if (is_array($value)) {
                $value = $this->recursivelyRemoveEmptyReplacements($value);
            }
        }

        return array_filter($input, function ($value) {
            if (is_string($value)) {
                return ! Str::startsWith($value, ':');
            }

            return true;
        });
    }

    /**
     * Create a new response array with replacement values.
     *
     * @return array
     */
    protected function newResponseArray()
    {
        return $this->format;
    }

    /**
     * Get the exception status code.
     *
     * @param Exception $exception
     * @param int        $defaultStatusCode
     *
     * @return int
     */
    protected function getExceptionStatusCode(Exception $exception, $defaultStatusCode = 500)
    {
        return ($exception instanceof HttpExceptionInterface) ? $exception->getStatusCode() : $defaultStatusCode;
    }

    /**
     * Determines if we are running in debug mode.
     *
     * @return bool
     */
    protected function runningInDebugMode()
    {
        return $this->debug;
    }

    /**
     * Get the hint for an exception handler.
     *
     * @param callable $callback
     *
     * @return string
     */
    protected function handlerHint(callable $callback)
    {
        $reflection = new ReflectionFunction($callback);

        $exception = $reflection->getParameters()[0];
        $reflectionType = $exception->getType();

        if ($reflectionType && ! $reflectionType->isBuiltin()) {
            if ($reflectionType instanceof \ReflectionNamedType) {
                return $reflectionType->getName();
            }
        }

        return '';
    }

    /**
     * Get the exception handlers.
     *
     * @return array
     */
    public function getHandlers()
    {
        return $this->handlers;
    }

    /**
     * Set the error format array.
     *
     * @param array $format
     *
     * @return void
     */
    public function setErrorFormat(array $format)
    {
        $this->format = $format;
    }

    /**
     * Set the debug mode.
     *
     * @param bool $debug
     *
     * @return void
     */
    public function setDebug($debug)
    {
        $this->debug = $debug;
    }
}


================================================
FILE: src/Exception/InternalHttpException.php
================================================
<?php

namespace Dingo\Api\Exception;

use Exception;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;

class InternalHttpException extends HttpException
{
    /**
     * The response.
     *
     * @var \Illuminate\Http\Response
     */
    protected $response;

    /**
     * Create a new internal HTTP exception instance.
     *
     * @param \Symfony\Component\HttpFoundation\Response $response
     * @param string                                     $message
     * @param \Exception                                 $previous
     * @param array                                      $headers
     * @param int                                        $code
     *
     * @return void
     */
    public function __construct(Response $response, $message = null, Exception $previous = null, array $headers = [], $code = 0)
    {
        $this->response = $response;

        parent::__construct($response->getStatusCode(), $message, $previous, $headers, $code);
    }

    /**
     * Get the response of the internal request.
     *
     * @return \Illuminate\Http\Response
     */
    public function getResponse()
    {
        return $this->response;
    }
}


================================================
FILE: src/Exception/RateLimitExceededException.php
================================================
<?php

namespace Dingo\Api\Exception;

use Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;

class RateLimitExceededException extends HttpException
{
    /**
     * Create a new rate limit exceeded exception instance.
     *
     * @param string     $message
     * @param \Exception $previous
     * @param array      $headers
     * @param int        $code
     *
     * @return void
     */
    public function __construct($message = null, Exception $previous = null, $headers = [], $code = 0)
    {
        if (array_key_exists('X-RateLimit-Reset', $headers)) {
            $headers['Retry-After'] = $headers['X-RateLimit-Reset'] - time();
        }

        parent::__construct(429, $message ?: 'You have exceeded your rate limit.', $previous, $headers, $code);
    }
}


================================================
FILE: src/Exception/ResourceException.php
================================================
<?php

namespace Dingo\Api\Exception;

use Exception;
use Illuminate\Support\MessageBag;
use Dingo\Api\Contract\Debug\MessageBagErrors;
use Symfony\Component\HttpKernel\Exception\HttpException;

class ResourceException extends HttpException implements MessageBagErrors
{
    /**
     * MessageBag errors.
     *
     * @var \Illuminate\Support\MessageBag
     */
    protected $errors;

    /**
     * Create a new resource exception instance.
     *
     * @param string                               $message
     * @param \Illuminate\Support\MessageBag|array $errors
     * @param \Exception                           $previous
     * @param array                                $headers
     * @param int                                  $code
     *
     * @return void
     */
    public function __construct($message = null, $errors = null, Exception $previous = null, $headers = [], $code = 0)
    {
        if (is_null($errors)) {
            $this->errors = new MessageBag;
        } else {
            $this->errors = is_array($errors) ? new MessageBag($errors) : $errors;
        }

        parent::__construct(422, $message, $previous, $headers, $code);
    }

    /**
     * Get the errors message bag.
     *
     * @return \Illuminate\Support\MessageBag
     */
    public function getErrors()
    {
        return $this->errors;
    }

    /**
     * Determine if message bag has any errors.
     *
     * @return bool
     */
    public function hasErrors()
    {
        return ! $this->errors->isEmpty();
    }
}


================================================
FILE: src/Exception/StoreResourceFailedException.php
================================================
<?php

namespace Dingo\Api\Exception;

class StoreResourceFailedException extends ResourceException
{
    //
}


================================================
FILE: src/Exception/UnknownVersionException.php
================================================
<?php

namespace Dingo\Api\Exception;

use Exception;
use Symfony\Component\HttpKernel\Exception\HttpException;

class UnknownVersionException extends HttpException
{
    /**
     * Create a new unknown version exception instance.
     *
     * @param string     $message
     * @param \Exception $previous
     * @param int        $code
     *
     * @return void
     */
    public function __construct($message = null, Exception $previous = null, $code = 0)
    {
        parent::__construct(400, $message ?: 'The version given was unknown or has no registered routes.', $previous, [], $code);
    }
}


================================================
FILE: src/Exception/UpdateResourceFailedException.php
================================================
<?php

namespace Dingo\Api\Exception;

class UpdateResourceFailedException extends ResourceException
{
    //
}


================================================
FILE: src/Exception/ValidationHttpException.php
================================================
<?php

namespace Dingo\Api\Exception;

use Exception;

class ValidationHttpException extends ResourceException
{
    /**
     * Create a new validation HTTP exception instance.
     *
     * @param \Illuminate\Support\MessageBag|array $errors
     * @param \Exception                           $previous
     * @param array                                $headers
     * @param int                                  $code
     *
     * @return void
     */
    public function __construct($errors = null, Exception $previous = null, $headers = [], $code = 0)
    {
        parent::__construct(null, $errors, $previous, $headers, $code);
    }
}


================================================
FILE: src/Facade/API.php
================================================
<?php

namespace Dingo\Api\Facade;

use Dingo\Api\Http\InternalRequest;
use Illuminate\Support\Facades\Facade;

class API extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'api.dispatcher';
    }

    /**
     * Bind an exception handler.
     *
     * @param callable $callback
     *
     * @return void
     */
    public static function error(callable $callback)
    {
        return static::$app['api.exception']->register($callback);
    }

    /**
     * Register a class transformer.
     *
     * @param string          $class
     * @param string|\Closure $transformer
     *
     * @return \Dingo\Api\Transformer\Binding
     */
    public static function transform($class, $transformer)
    {
        return static::$app['api.transformer']->register($class, $transformer);
    }

    /**
     * Get the authenticator.
     *
     * @return \Dingo\Api\Auth\Auth
     */
    public static function auth()
    {
        return static::$app['api.auth'];
    }

    /**
     * Get the authenticated user.
     *
     * @return \Illuminate\Auth\GenericUser|\Illuminate\Database\Eloquent\Model
     */
    public static function user()
    {
        return static::$app['api.auth']->user();
    }

    /**
     * Determine if a request is internal.
     *
     * @return bool
     */
    public static function internal()
    {
        return static::$app['api.router']->getCurrentRequest() instanceof InternalRequest;
    }

    /**
     * Get the response factory to begin building a response.
     *
     * @return \Dingo\Api\Http\Response\Factory
     */
    public static function response()
    {
        return static::$app['api.http.response'];
    }

    /**
     * Get the API router instance.
     *
     * @return \Dingo\Api\Routing\Router
     */
    public static function router()
    {
        return static::$app['api.router'];
    }

    /**
     * Get the API route of the given name, and optionally specify the API version.
     *
     * @param string $routeName
     * @param string $apiVersion
     *
     * @return string
     */
    public static function route($routeName, $apiVersion = 'v1')
    {
        return static::$app['api.url']->version($apiVersion)->route($routeName);
    }
}


================================================
FILE: src/Facade/Route.php
================================================
<?php

namespace Dingo\Api\Facade;

use Illuminate\Support\Facades\Facade;

class Route extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'api.router';
    }
}


================================================
FILE: src/Http/FormRequest.php
================================================
<?php

namespace Dingo\Api\Http;

use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse;
use Illuminate\Contracts\Container\Container;
use Illuminate\Contracts\Validation\Validator;
use Dingo\Api\Exception\ValidationHttpException;
use Illuminate\Validation\ValidatesWhenResolvedTrait;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Contracts\Validation\ValidatesWhenResolved;
use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;

class FormRequest extends Request implements ValidatesWhenResolved
{
    use ValidatesWhenResolvedTrait;

    /**
     * The container instance.
     *
     * @var \Illuminate\Contracts\Container\Container
     */
    protected $container;

    /**
     * The redirector instance.
     *
     * @var \Illuminate\Routing\Redirector
     */
    protected $redirector;

    /**
     * The URI to redirect to if validation fails.
     *
     * @var string
     */
    protected $redirect;

    /**
     * The route to redirect to if validation fails.
     *
     * @var string
     */
    protected $redirectRoute;

    /**
     * The controller action to redirect to if validation fails.
     *
     * @var string
     */
    protected $redirectAction;

    /**
     * The key to be used for the view error bag.
     *
     * @var string
     */
    protected $errorBag = 'default';

    /**
     * The input keys that should not be flashed on redirect.
     *
     * @var array
     */
    protected $dontFlash = [
        'password',
        'password_confirmation',
    ];

    /**
     * Validate the request.
     */
    public function validate()
    {
        if ($this->authorize() === false) {
            throw new AccessDeniedHttpException();
        }

        $validator = app('validator')->make($this->all(), $this->rules(), $this->messages());

        if ($validator->fails()) {
            throw new ValidationHttpException($validator->errors());
        }
    }

    /**
     * Get the validator instance for the request.
     *
     * @return \Illuminate\Contracts\Validation\Validator
     *
     * @SuppressWarnings(PHPMD.ElseExpression)
     */
    protected function getValidatorInstance()
    {
        $factory = $this->container->make(ValidationFactory::class);

        if (method_exists($this, 'validator')) {
            $validator = $this->container->call([$this, 'validator'], compact('factory'));
        } else {
            $validator = $this->createDefaultValidator($factory);
        }

        if (method_exists($this, 'withValidator')) {
            $this->withValidator($validator);
        }

        return $validator;
    }

    /**
     * Create the default validator instance.
     *
     * @param  \Illuminate\Contracts\Validation\Factory  $factory
     *
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function createDefaultValidator(ValidationFactory $factory)
    {
        return $factory->make(
            $this->validationData(),
            $this->container->call([$this, 'rules']),
            $this->messages(),
            $this->attributes()
        );
    }

    /**
     * Get data to be validated from the request.
     *
     * @return array
     */
    protected function validationData()
    {
        return $this->all();
    }

    /**
     * Handle a failed validation attempt.
     *
     * @param  \Illuminate\Contracts\Validation\Validator  $validator
     *
     * @return void
     */
    protected function failedValidation(Validator $validator)
    {
        if ($this->container['request'] instanceof Request) {
            throw new ValidationHttpException($validator->errors());
        }

        parent::failedValidation($validator);
    }

    /**
     * Get the proper failed validation response for the request.
     *
     * @param  array  $errors
     *
     * @return \Symfony\Component\HttpFoundation\Response
     */
    public function response(array $errors)
    {
        if ($this->expectsJson()) {
            return new JsonResponse($errors, 422);
        }

        return $this->redirector->to($this->getRedirectUrl())
            ->withInput($this->except($this->dontFlash))
            ->withErrors($errors, $this->errorBag);
    }

    /**
     * Format the errors from the given Validator instance.
     *
     * @param  \Illuminate\Contracts\Validation\Validator  $validator
     *
     * @return array
     */
    protected function formatErrors(Validator $validator)
    {
        return $validator->getMessageBag()->toArray();
    }

    /**
     * Get the URL to redirect to on a validation error.
     *
     * @return string
     */
    protected function getRedirectUrl()
    {
        $url = $this->redirector->getUrlGenerator();

        if ($this->redirect) {
            return $url->to($this->redirect);
        } elseif ($this->redirectRoute) {
            return $url->route($this->redirectRoute);
        } elseif ($this->redirectAction) {
            return $url->action($this->redirectAction);
        }

        return $url->previous();
    }

    /**
     * Determine if the request passes the authorization check.
     *
     * @return bool
     */
    protected function passesAuthorization()
    {
        if (method_exists($this, 'authorize')) {
            return $this->container->call([$this, 'authorize']);
        }

        return false;
    }

    /**
     * Handle a failed authorization attempt.
     *
     * @return void
     */
    protected function failedAuthorization()
    {
        if ($this->container['request'] instanceof Request) {
            throw new HttpException(403);
        }

        parent::failedAuthorization();
    }

    /**
     * Get custom messages for validator errors.
     *
     * @return array
     */
    public function messages()
    {
        return [];
    }

    /**
     * Get custom attributes for validator errors.
     *
     * @return array
     */
    public function attributes()
    {
        return [];
    }

    /**
     * Set the Redirector instance.
     *
     * @param \Laravel\Lumen\Http\Redirector|\Illuminate\Routing\Redirector $redirector
     *
     * @return $this
     */
    public function setRedirector($redirector)
    {
        $this->redirector = $redirector;

        return $this;
    }

    /**
     * Set the container implementation.
     *
     * @param  \Illuminate\Contracts\Container\Container  $container
     *
     * @return $this
     */
    public function setContainer(Container $container)
    {
        $this->container = $container;

        return $this;
    }
}


================================================
FILE: src/Http/InternalRequest.php
================================================
<?php

namespace Dingo\Api\Http;

class InternalRequest extends Request
{
    public function __construct(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null)
    {
        parent::__construct($query, $request, $attributes, $cookies, $files, $server, $content);

        // Pass parameters inside internal request into Laravel's JSON ParameterBag,
        // so that they can be accessed using $request->input()
        if ($this->isJson() && isset($this->request)) {
            $this->setJson($this->request);
        }
    }
}


================================================
FILE: src/Http/Middleware/Auth.php
================================================
<?php

namespace Dingo\Api\Http\Middleware;

use Closure;
use Dingo\Api\Routing\Router;
use Dingo\Api\Auth\Auth as Authentication;

class Auth
{
    /**
     * Router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * Authenticator instance.
     *
     * @var \Dingo\Api\Auth\Auth
     */
    protected $auth;

    /**
     * Create a new auth middleware instance.
     *
     * @param \Dingo\Api\Routing\Router $router
     * @param \Dingo\Api\Auth\Auth      $auth
     *
     * @return void
     */
    public function __construct(Router $router, Authentication $auth)
    {
        $this->router = $router;
        $this->auth = $auth;
    }

    /**
     * Perform authentication before a request is executed.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure                 $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $route = $this->router->getCurrentRoute();

        if (! $this->auth->check(false)) {
            $this->auth->authenticate($route->getAuthenticationProviders());
        }

        return $next($request);
    }
}


================================================
FILE: src/Http/Middleware/PrepareController.php
================================================
<?php

namespace Dingo\Api\Http\Middleware;

use Closure;
use Dingo\Api\Routing\Router;

class PrepareController
{
    /**
     * Dingo router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * Create a new prepare controller instance.
     *
     * @param \Dingo\Api\Routing\Router $router
     *
     * @return void
     */
    public function __construct(Router $router)
    {
        $this->router = $router;
    }

    /**
     * Handle the request.
     *
     * @param \Dingo\Api\Http\Request $request
     * @param \Closure                $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        // To prepare the controller all we need to do is call the current method on the router to fetch
        // the current route. This will create a new Dingo\Api\Routing\Route instance and prepare the
        // controller by binding it as a singleton in the container. This will result in the
        // controller only be instantiated once per request.
        $this->router->current();

        return $next($request);
    }
}


================================================
FILE: src/Http/Middleware/RateLimit.php
================================================
<?php

namespace Dingo\Api\Http\Middleware;

use Closure;
use Dingo\Api\Http\Response;
use Dingo\Api\Routing\Router;
use Dingo\Api\Http\InternalRequest;
use Dingo\Api\Http\RateLimit\Handler;
use Dingo\Api\Exception\RateLimitExceededException;

class RateLimit
{
    /**
     * Router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * Rate limit handler instance.
     *
     * @var \Dingo\Api\Http\RateLimit\Handler
     */
    protected $handler;

    /**
     * Create a new rate limit middleware instance.
     *
     * @param \Dingo\Api\Routing\Router         $router
     * @param \Dingo\Api\Http\RateLimit\Handler $handler
     *
     * @return void
     */
    public function __construct(Router $router, Handler $handler)
    {
        $this->router = $router;
        $this->handler = $handler;
    }

    /**
     * Perform rate limiting before a request is executed.
     *
     * @param \Dingo\Api\Http\Request $request
     * @param \Closure                $next
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if ($request instanceof InternalRequest) {
            return $next($request);
        }

        $route = $this->router->getCurrentRoute();

        if ($route->hasThrottle()) {
            $this->handler->setThrottle($route->getThrottle());
        }

        $this->handler->rateLimitRequest($request, $route->getRateLimit(), $route->getRateLimitExpiration());

        if ($this->handler->exceededRateLimit()) {
            throw new RateLimitExceededException('You have exceeded your rate limit.', null, $this->getHeaders());
        }

        $response = $next($request);

        if ($this->handler->requestWasRateLimited()) {
            return $this->responseWithHeaders($response);
        }

        return $response;
    }

    /**
     * Send the response with the rate limit headers.
     *
     * @param \Dingo\Api\Http\Response $response
     *
     * @return \Dingo\Api\Http\Response
     */
    protected function responseWithHeaders($response)
    {
        foreach ($this->getHeaders() as $key => $value) {
            $response->headers->set($key, $value);
        }

        return $response;
    }

    /**
     * Get the headers for the response.
     *
     * @return array
     */
    protected function getHeaders()
    {
        return [
            'X-RateLimit-Limit' => $this->handler->getThrottleLimit(),
            'X-RateLimit-Remaining' => $this->handler->getRemainingLimit(),
            'X-RateLimit-Reset' => $this->handler->getRateLimitReset(),
        ];
    }
}


================================================
FILE: src/Http/Middleware/Request.php
================================================
<?php

namespace Dingo\Api\Http\Middleware;

use Closure;
use Exception;
use Dingo\Api\Routing\Router;
use Laravel\Lumen\Application;
use Illuminate\Pipeline\Pipeline;
use Dingo\Api\Http\RequestValidator;
use Dingo\Api\Event\RequestWasMatched;
use Dingo\Api\Http\Request as HttpRequest;
use Illuminate\Contracts\Container\Container;
use Dingo\Api\Contract\Debug\ExceptionHandler;
use Dingo\Api\Contract\Http\Request as RequestContract;
use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;
use Illuminate\Contracts\Debug\ExceptionHandler as LaravelExceptionHandler;

class Request
{
    /**
     * Application instance.
     *
     * @var \Illuminate\Contracts\Foundation\Application
     */
    protected $app;

    /**
     * Exception handler instance.
     *
     * @var \Dingo\Api\Contract\Debug\ExceptionHandler
     */
    protected $exception;

    /**
     * Router instance.
     *
     * @var \Dingo\Api\Routing\Router
     */
    protected $router;

    /**
     * HTTP validator instance.
     *
     * @var \Dingo\Api\Http\Validator
     */
    protected $validator;

    /**
     * Event dispatcher instance.
     *
     * @var \Illuminate\Contracts\Events\Dispatcher
     */
    protected $events;

    /**
     * Array of middleware.
     *
     * @var array
     */
    protected $middleware = [];

    /**
     * Create a new request middleware instance.
     *
     * @param \Illuminate\Contracts\Foundation\Application $app
     * @param \Dingo\Api\Contract\Debug\ExceptionHandler   $exception
     * @param \Dingo\Api\Routing\Router                    $router
     * @param \Dingo\Api\Http\RequestValidator             $validator
     * @param \Illuminate\Contracts\Events\Dispatcher      $events
     *
     * @return void
     */
    public function __construct(Container $app, ExceptionHandler $exception, Router $router, RequestValidator $validator, EventDispatcher $events)
    {
        $this->app = $app;
        $this->exception = $exception;
        $this->router = $router;
        $this->validator = $validator;
        $this->events = $events;
    }

    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure                 $next
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        try {
            if ($this->validator->validateRequest($request)) {
                $this->app->singleton(LaravelExceptionHandler::class, function ($app) {
                    return $app[ExceptionHandler::class];
                });

                $request = $this->app->make(RequestContract::class)->createFromIlluminate($request);

                $this->events->dispatch(new RequestWasMatched($request, $this->app));

                return $this->sendRequestThroughRouter($request);
            }
        } catch (Exception $exception) {
            $this->exception->report($exception);

            return $this->exception->handle($exception);
        }

        return $next($request);
    }

    /**
     * Send the request through the Dingo router.
     *
     * @param \Dingo\Api\Http\Request $request
     *
     * @return \Dingo\Api\Http\Response
     */
    protected function sendRequestThroughRouter(HttpRequest $request)
    {
        $this->app->instance('request', $request);

        return (new Pipeline($this->app))->send($request)->through($this->middleware)->then(function ($request) {
            return $this->router->dispatch($request);
        });
    }

    /**
     * Call the terminate method on middlewares.
     *
     * @return void
     */
    public function terminate($request, $response)
    {
        if (! ($request = $this->app['request']) instanceof HttpRequest) {
            return;
        }

        // Laravel's route middlewares can be terminated just like application
        // middleware, so we'll gather all the route middleware here.
        // On Lumen this will simply be an empty array as it does
        // not implement terminable route middleware.
        $middlewares = $this->gatherRouteMiddlewares($request);

        // Because of how middleware is executed on Lumen we'll need to merge in the
        // application middlewares now so that we can terminate them. Laravel does
        // not need this as it handles things a little more gracefully so it
        // can terminate the application ones itself.
        if (class_exists(Application::class, false)) {
            $middlewares = array_merge($middlewares, $this->middleware);
        }

        foreach ($middlewares as $middleware) {
            if ($middleware instanceof Closure) {
                continue;
            }

            [$name, $parameters] = $this->parseMiddleware($middleware);

            $instance = $this->app->make($name);

            if (method_exists($instance, 'terminate')) {
                $instance->terminate($request, $response);
            }
        }
    }

    /**
     * Parse a middleware string to get the name and parameters.
     *
     * @author Taylor Otwell
     *
     * @param string $middleware
     *
     * @return array
     */
    protected function parseMiddleware($middleware)
    {
        [$name, $parameters] = array_pad(explode(':', $middleware, 2), 2, []);

        if (is_string($parameters)) {
            $parameters = explode(',', $parameters);
        }

        return [$name, $parameters];
    }

    /**
     * Gather the middlewares for the route.
     *
     * @param \Dingo\Api\Http\Request $request
     *
     * @return array
     */
    protected function gatherRouteMiddlewares($request)
    {
        if ($route = $request->route()) {
            return $this->router->gatherRouteMiddlewares($route);
        }

        return [];
    }

    /**
     * Set the middlewares.
     *
     * @param array $middleware
     *
     * @return void
     */
    public function setMiddlewares(array $middleware)
    {
        $this->middleware = $middleware;
    }

    /**
     * Merge new middlewares onto the existing middlewares.
     *
     * @param array $middleware
     *
     * @return void
     */
    public function mergeMiddlewares(array $middleware)
    {
        $this->middleware = array_merge($this->middleware, $middleware);
    }
}


================================================
FILE: src/Http/Parser/Accept.php
================================================
<?php

namespace Dingo\Api\Http\Parser;

use Illuminate\Http\Request;
use Dingo\Api\Contract\Http\Parser;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

class Accept implements Parser
{
    /**
     * Standards tree.
     *
     * @var string
     */
    protected $standardsTree;

    /**
     * API subtype.
     *
     * @var string
     */
    protected $subtype;

    /**
     * Default version.
     *
     * @var string
     */
    protected $version;

    /**
     * Default format.
     *
     * @var string
     */
    protected $format;

    /**
     * Create a new accept parser instance.
     *
     * @param string $standardsTree
     * @param string $subtype
     * @param string $version
     * @param string $format
     *
     * @return void
     */
    public function __construct($standardsTree, $subtype, $version, $format)
    {
        $this->standardsTree = $standardsTree;
        $this->subtype = $subtype;
        $this->version = $version;
        $this->format = $format;
    }

    /**
     * Parse the accept header on the incoming request. If strict is enabled
     * then the accept header must be available and must be a valid match.
     *
     * @param \Illuminate\Http\Request $request
     * @param bool                     $strict
     *
     * @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
     *
     * @return array
     */
    public function parse(Request $request, $strict = false)
    {
        $pattern = '/application\/'.$this->standardsTree.'\.('.$this->subtype.')\.([\w\d\.\-]+)\+([\w]+)/';

        if (! preg_match($pattern, $request->header('accept'), $matches)) {
            if ($strict) {
                throw new BadRequestHttpException('Accept header could not be properly parsed because of a strict matching process.');
            }

            $default = 'application/'.$this->standardsTree.'.'.$this->subtype.'.'.$this->version.'+'.$this->format;

            preg_match($pattern, $default, $matches);
        }

        return array_combine(['subtype', 'version', 'format'], array_slice($matches, 1));
    }
}


================================================
FILE: src/Http/RateLimit/Handler.php
================================================
<?php

namespace Dingo\Api\Http\RateLimit;

use Dingo\Api\Http\Request;
use Illuminate\Support\Carbon;
use Illuminate\Cache\CacheManager;
use Illuminate\Support\Collection;
use Illuminate\Container\Container;
use Dingo\Api\Http\RateLimit\Throttle\Route;
use Dingo\Api\Contract\Http\RateLimit\Throttle;
use Dingo\Api\Contract\Http\RateLimit\HasRateLimiter;

class Handler
{
    /**
     * Container instance.
     *
     * @var \Illuminate\Container\Container
     */
    protected $container;

    /**
     * Cache instance.
     *
     * @var \Illuminate\Cache\CacheManager
     */
    protected $cache;

    /**
     * Registered throttles.
     *
     * @var \Illuminate\Support\Collection
     */
    protected $throttles;

    /**
     * Throttle used for rate limiting.
     *
     * @var \Dingo\Api\Contract\Http\RateLimit\Throttle
     */
    protected $throttle;

    /**
     * Request instance being throttled.
     *
     * @var \Dingo\Api\Http\Request
     */
    protected $request;

    /**
     * The key prefix used when throttling route specific requests.
     *
     * @var string
     */
    protected $keyPrefix;

    /**
     * A callback used to define the limiter.
     *
     * @var callable
     */
    protected $limiter;

    /**
     * Create a new rate limit handler instance.
     *
     * @param \Illuminate\Container\Container $container
     * @param \Illuminate\Cache\CacheManager  $cache
     * @param array                           $throttles
     *
     * @return void
     */
    public function __construct(Container $container, CacheManager $cache, array $throttles)
    {
        $this->cache = $cache;
        $this->container = $container;
        $this->throttles = new Collection($throttles);
    }

    /**
     * Execute the rate limiting for the given request.
     *
     * @param \Dingo\Api\Http\Request $request
     * @param int                     $limit
     * @param int                     $expires
     *
     * @return void
     */
    public function rateLimitRequest(Request $request, $limit = 0, $expires = 0)
    {
        $this->request = $request;

        // If the throttle instance is already set then we'll just carry on as
        // per usual.
        if ($this->throttle instanceof Throttle) {

            // If the developer specified a certain amount of requests or expiration
        // time on a specific route then we'll always use the route specific
        // throttle with the given values.
        } elseif ($limit > 0 || $expires > 0) {
            $this->throttle = new Route(['limit' => $limit, 'expires' => $expires]);
            $this->keyPrefix = sha1($request->path());

        // Otherwise we'll use the throttle that gives the consumer the largest
        // amount of requests. If no matching throttle is found then rate
        // limiting will not be imposed for the request.
        } else {
            $this->throttle = $this->getMatchingThrottles()->sort(function ($a, $b) {
                return $a->getLimit() < $b->getLimit();
            })->first();
        }

        if (is_null($this->throttle)) {
            return;
        }

        if ($this->throttle instanceof HasRateLimiter) {
            $this->setRateLimiter([$this->throttle, 'getRateLimiter']);
        }

        $this->prepareCacheStore();

        $this->cache('requests', 0, $this->throttle->getExpires());
        $this->cache('expires', $this->throttle->getExpires(), $this->throttle->getExpires());
        $this->cache('reset', time() + ($this->throttle->getExpires() * 60), $this->throttle->getExpires());
        $this->increment('requests');
    }

    /**
     * Prepare the cache store.
     *
     * @return void
     */
    protected function prepareCacheStore()
    {
        if ($this->retrieve('expires') != $this->throttle->getExpires()) {
            $this->forget('requests');
            $this->forget('expires');
            $this->forget('reset');
        }
    }

    /**
     * Determine if the rate limit has been exceeded.
     *
     * @return bool
     */
    public function exceededRateLimit()
    {
        return $this->requestWasRateLimited() ? $this->retrieve('requests') > $this->throttle->getLimit() : false;
    }

    /**
     * Get matching throttles after executing the condition of each throttle.
     *
     * @return \Illuminate\Support\Collection
     */
    protected function getMatchingThrottles()
    {
        return $this->throttles->filter(function ($throttle) {
            return $throttle->match($this->container);
        });
    }

    /**
     * Namespace a cache key.
     *
     * @param string $key
     *
     * @return string
     */
    protected function key($key)
    {
        return sprintf('dingo.api.%s.%s', $key, $this->getRateLimiter());
    }

    /**
     * Cache a value under a given key for a certain amount of minutes.
     *
     * @param string $key
     * @param mixed  $value
     * @param int    $minutes
     *
     * @return void
     */
    protected function cache($key, $value, $minutes)
    {
        $this->cache->add($this->key($key), $value, Carbon::now()->addMinutes($minutes));
    }

    /**
     * Retrieve a value from the cache store.
     *
     * @param string $key
     *
     * @return mixed
     */
    protected function retrieve($key)
    {
        return $this->cache->get($this->key($key));
    }

    /**
     * Increment a key in the cache.
     *
     * @param string $key
     *
     * @return void
     */
    protected function increment($key)
    {
        $this->cache->increment($this->key($key));
    }

    /**
     * Forget a key in the cache.
     *
     * @param string $key
     *
     * @return void
     */
    protected function forget($key)
    {
        $this->cache->forget($this->key($key));
    }

    /**
     * Determine if the request was rate limited.
     *
     * @return bool
     */
    public function requestWasRateLimited()
    {
        return ! is_null($this->throttle);
    }

    /**
     * Get the rate limiter.
     *
     * @return string
     */
    public function getRateLimiter()
    {
        return call_user_func($this->limiter ?: function ($container, $request) {
            return $request->getClientIp();
        }, $this->container, $this->request);
    }

    /**
     * Set the rate limiter.
     *
     * @param callable $limiter
     *
     * @return void
     */
    public function setRateLimiter(callable $limiter)
    {
        $this->limiter = $limiter;
    }

    /**
     * Set the throttle to use for rate limiting.
     *
     * @param string|\Dingo\Api\Contract\Http\RateLimit\Throttle $throttle
     *
     * @return void
     */
    public function setThrottle($throttle)
    {
        if (is_string($throttle)) {
            $throttle = $this->container->make($throttle);
        }

        $this->throttle = $throttle;
    }

    /**
     * Get the throttle used to rate limit the request.
     *
     * @return \Dingo\Api\Contract\Http\RateLimit\Throttle
     */
    public function getThrottle()
    {
        return $this->throttle;
    }

    /**
     * Get the limit of the throttle used.
     *
     * @return int
     */
    public function getThrottleLimit()
    {
        return $this->throttle->getLimit();
    }

    /**
     * Get the remaining limit before the consumer is rate limited.
     *
     * @return int
     */
    public function getRemainingLimit()
    {
        $remaining = $this->throttle->getLimit() - $this->retrieve('requests');

        return $remaining > 0 ? $remaining : 0;
    }

    /**
     * Get the timestamp for when the current rate limiting will expire.
     *
     * @return int
     */
    public function getRateLimitReset()
    {
        return $this->retrieve('reset');
    }

    /**
     * Extend the rate limiter by adding a new throttle.
     *
     * @param callable|\Dingo\Api\Http\RateLimit\Throttle $throttle
     *
     * @return void
     */
    public function extend($throttle)
    {
        if (is_callable($throttle)) {
            $throttle = call_user_func($throttle, $this->container);
        }

        $this->throttles->push($throttle);
    }
}


================================================
FILE: src/Http/RateLimit/Throttle/Authenticated.php
================================================
<?php

namespace Dingo\Api\Http\RateLimit\Throttle;

use Illuminate\Container\Container;

class Authenticated extends Throttle
{
    /**
     * Authenticated throttle will be matched when request is authenticated.
     *
     * @param \Illuminate\Container\Container $container
     *
     * @return bool
     */
    public function match(Container $container)
    {
        return $container['api.auth']->check();
    }
}


================================================
FILE: src/Http/RateLimit/Throttle/Route.php
================================================
<?php

namespace Dingo\Api\Http\RateLimit\Throttle;

use Illuminate\Container\Container;

class Route extends Throttle
{
    /**
     * Route specific throttles always match.
     *
     * @param \Illuminate\Container\Container $container
     *
     * @return bool
     */
    public function match(Container $container)
    {
        return true;
    }
}


================================================
FILE: src/Http/RateLimit/Throttle/Throttle.php
================================================
<?php

namespace Dingo\Api\Http\RateLimit\Throttle;

use Dingo\Api\Contract\Http\RateLimit\Throttle as RateLimitThrottle;

abstract class Throttle implements RateLimitThrottle
{
    /**
     * Array of throttle options.
     *
     * @var array
     */
    protected $options = ['limit' => 60, 'expires' => 60];

    /**
     * Create a new throttle instance.
     *
     * @param array $options
     *
     * @return void
     */
    public function __construct(array $options = [])
    {
        $this->options = array_merge($this->options, $options);
    }

    /**
     * Get the throttles request limit.
     *
     * @return int
     */
    public function getLimit()
    {
        return $this->options['limit'];
    }

    /**
     * Get the time in minutes that the throttles request limit will expire.
     *
     * @return int
     */
    public function getExpires()
    {
        return $this->options['expires'];
    }
}


================================================
FILE: src/Http/RateLimit/Throttle/Unauthenticated.php
================================================
<?php

namespace Dingo\Api\Http\RateLimit\Throttle;

use Illuminate\Container\Container;

class Unauthenticated extends Throttle
{
    /**
     * Unauthenticated throttle will be matched when request is not authenticated.
     *
     * @param \Illuminate\Container\Container $container
     *
     * @return bool
     */
    public function match(Container $container)
    {
        return ! $container['api.auth']->check();
    }
}


================================================
FILE: src/Http/Request.php
================================================
<?php

namespace Dingo\Api\Http;

use Dingo\Api\Http\Parser\Accept;
use Illuminate\Http\Request as IlluminateRequest;
use Dingo\Api\Contract\Http\Request as RequestInterface;

class Request extends IlluminateRequest implements RequestInterface
{
    /**
     * Accept parser instance.
     *
     * @var \Dingo\Api\Http\Parser\Accept
     */
    protected static $acceptParser;

    /**
     * Parsed accept header for the request.
     *
     * @var array
     */
    protected $accept;

    /**
     * Create a new Dingo request instance from an Illuminate request instance.
     *
     * @param \Illuminate\Http\Request $old
     *
     * @return \Dingo\Api\Http\Request
     */
    public function createFromIlluminate(IlluminateRequest $old)
    {
        $new = new static(
            $old->query->all(), $old->request->all(), $old->attributes->all(),
            $old->cookies->all(), $old->files->all(), $old->server->all(), $old->content
        );

        if ($session = $old->getSession()) {
            $new->setLaravelSession($old->getSession());
        }

        $new->setRouteResolver($old->getRouteResolver());
        $new->setUserResolver($old->getUserResolver());

        return $new;
    }

    /**
     * Get the defined version.
     *
     * @return string
     */
    public function version()
    {
        $this->parseAcceptHeader();

        return $this->accept['version'];
    }

    /**
     * Get the defined subtype.
     *
     * @return string
     */
    public function subtype()
    {
        $this->parseAcceptHeader();

        return $this->accept['subtype'];
    }

    /**
     * Get the expected format type.
     *
     * @return string
     */
    public function format($default = 'html')
    {
        $this->parseAcceptHeader();

        return $this->accept['format'] ?: parent::format($default);
    }

    /**
     * Parse the accept header.
     *
     * @return void
     */
    protected function parseAcceptHeader()
    {
        if ($this->accept) {
            return;
        }

        $this->accept = static::$acceptParser->parse($this);
    }

    /**
     * Set the accept parser instance.
     *
     * @param \Dingo\Api\Http\Parser\Accept $acceptParser
     *
     * @return void
     */
    public static function setAcceptParser(Accept $acceptParser)
    {
        static::$acceptParser = $acceptParser;
    }

    /**
     * Get the accept parser instance.
     *
     * @return \Dingo\Api\Http\Parser\Accept
     */
    public static function getAcceptParser()
    {
        return static::$acceptParser;
    }
}


================================================
FILE: src/Http/RequestValidator.php
================================================
<?php

namespace Dingo\Api\Http;

use Illuminate\Container\Container;
use Dingo\Api\Http\Validation\Accept;
use Dingo\Api\Http\Validation\Domain;
use Dingo\Api\Http\Validation\Prefix;
use Dingo\Api\Contract\Http\Validator;
use Illuminate\Http\Request as IlluminateRequest;

class RequestValidator
{
    /**
     * Container instance.
     *
     * @var \Illuminate\Container\Container
     */
    protected $container;

    /**
     * Array of request validators.
     *
     * @var array
     */
    protected $validators = [
        Domain::class,
        Prefix::class,
    ];

    /**
     * Create a new request validator instance.
     *
     * @param \Illuminate\Container\Container $container
     *
     * @return void
     */
    public function __construct(Container $container)
    {
        $this->container = $container;
    }

    /**
     * Replace the validators.
     *
     * @param array $validators
     *
     * @return void
     */
    public function replace(array $validators)
    {
        $this->validators = $validators;
    }

    /**
     * Merge an array of validators.
     *
     * @param array $validators
     *
     * @return void
     */
    public function merge(array $validators)
    {
        $this->validators = array_merge($this->validators, $validators);
    }

    /**
     * Extend the validators.
     *
     * @param string|\Dingo\Api\Http\Validator $validator
     *
     * @return void
     */
    public function extend($validator)
    {
        $this->validators[] = $validator;
    }

    /**
     * Validate a request.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return bool
     */
    public function validateRequest(IlluminateRequest $request)
    {
        $passed = false;

        foreach ($this->validators as $validator) {
            $validator = $this->container->make($validator);

            if ($validator instanceof Validator && $validator->validate($request)) {
                $passed = true;
            }
        }

        // The accept validator will always be run once any of the previous validators have
        // been run. This ensures that we only run the accept validator once we know we
        // have a request that is targeting the API.
        if ($passed) {
            $this->container->make(Accept::class)->validate($request);
        }

        return $passed;
    }
}


================================================
FILE: src/Http/Response/Factory.php
================================================
<?php

namespace Dingo\Api\Http\Response;

use Closure;
use ErrorException;
use Illuminate\Support\Str;
use Dingo\Api\Http\Response;
use Illuminate\Support\Collection;
use Illuminate\Contracts\Pagination\Paginator;
use Dingo\Api\Transformer\Factory as TransformerFactory;
use Symfony\Component\HttpKernel\Exception\HttpException;

class Factory
{
    /**
     * Transformer factory instance.
     *
     * @var \Dingo\Api\Transformer\Factory
     */
    protected $transformer;

    /**
     * Create a new response factory instance.
     *
     * @param \Dingo\Api\Transformer\Factory $transformer
     *
     * @return void
     */
    public function __construct(TransformerFactory $transformer)
    {
        $this->transformer = $transformer;
    }

    /**
     * Respond with a created response and associate a location if provided.
     *
     * @param null|string $location
     *
     * @return \Dingo\Api\Http\Response
     */
    public function created($location = null, $content = null)
    {
        $response = new Response($content);
        $response->setStatusCode(201);

        if (! is_null($location)) {
            $response->header('Location', $location);
        }

        return $response;
    }

    /**
     * Respond with an accepted response and associate a location and/or content if provided.
     *
     * @param null|string $location
     * @param mixed       $content
     *
     * @return \Dingo\Api\Http\Response
     */
    public function accepted($location = null, $content = null)
    {
        $response = new Response($content);
        $response->setStatusCode(202);

        if (! is_null($location)) {
            $response->header('Location', $location);
        }

        return $response;
    }

    /**
     * Respond with a no content response.
     *
     * @return \Dingo\Api\Http\Response
     */
    public function noContent()
    {
        $response = new Response(null);

        return $response->setStatusCode(204);
    }

    /**
     * Bind a collection to a transformer and start building a response.
     *
     * @param \Illuminate\Support\Collection $collection
     * @param string|callable|object         $transformer
     * @param array|\Closure                 $parameters
     * @param \Closure|null                  $after
     *
     * @return \Dingo\Api\Http\Response
     */
    public function collection(Collection $collection, $transformer = null, $parameters = [], Closure $after = null)
    {
        if ($collection->isEmpty()) {
            $class = get_class($collection);
        } else {
            $class = get_class($collection->first());
        }

        if ($parameters instanceof \Closure) {
            $after = $parameters;
            $parameters = [];
        }

        if ($transformer !== null) {
            $binding = $this->transformer->register($class, $transformer, $parameters, $after);
        } else {
            $binding = $this->transformer->getBinding($collection);
        }

        return new Response($collection, 200, [], $binding);
    }

    /**
     * Bind an item to a transformer and start building a response.
     *
     * @param object                         $item
     * @param null|string|callable|object    $transformer
     * @param array                          $parameters
     * @param \Closure                       $after
     *
     * @return \Dingo\Api\Http\Response
     */
    public function item($item, $transformer = null, $parameters = [], Closure $after = null)
    {
        // Check for $item being null
        if (! is_null($item)) {
            $class = get_class($item);
        } else {
            $class = \StdClass::class;
        }

        if ($parameters instanceof \Closure) {
            $after = $parameters;
            $parameters = [];
        }

        if ($transformer !== null) {
            $binding = $this->transformer->register($class, $transformer, $parameters, $after);
        } else {
            $binding = $this->transformer->getBinding($item);
        }

        return new Response($item, 200, [], $binding);
    }

    /**
     * Bind an arbitrary array to a transformer and start building a response.
     *
     * @param array $array
     * @param $transformer
     * @param array $parameters
     * @param Closure|null $after
     *
     * @return Response
     */
    public function array(array $array, $transformer = null, $parameters = [], Closure $after = null)
    {
        if ($parameters instanceof \Closure) {
            $after = $parameters;
            $parameters = [];
        }

        // For backwards compatibility, allow no transformer
        if ($transformer) {
            // Use the PHP stdClass for this purpose, as a work-around, since we need to register a class binding
            $class = 'stdClass';
            // This will convert the array into an stdClass
            $array = (object) $array;

            $binding = $this->transformer->register($class, $transformer, $parameters, $after);
        } else {
            $binding = null;
        }

        return new Response($array, 200, [], $binding);
    }

    /**
     * Bind a paginator to a transformer and start building a response.
     *
     * @param \Illuminate\Contracts\Pagination\Paginator $paginator
     * @param null|string|callable|object                $transformer
     * @param array                                      $parameters
     * @param \Closure                                   $after
     *
     * @return \Dingo\Api\Http\Response
     */
    public function paginator(Paginator $paginator, $transformer = null, array $parameters = [], Closure $after = null)
    {
        if ($paginator->isEmpty()) {
            $class = get_class($paginator);
        } else {
            $class = get_class($paginator->first());
        }

        if ($transformer !== null) {
            $binding = $this->transformer->register($class, $transformer, $parameters, $after);
        } else {
            $binding = $this->transformer->getBinding($paginator->first());
        }

        return new Response($paginator, 200, [], $binding);
    }

    /**
     * Return an error response.
     *
     * @param string $message
     * @param int    $statusCode
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return void
     */
    public function error($message, $statusCode)
    {
        throw new HttpException($statusCode, $message);
    }

    /**
     * Return a 404 not found error.
     *
     * @param string $message
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return void
     */
    public function errorNotFound($message = 'Not Found')
    {
        $this->error($message, 404);
    }

    /**
     * Return a 400 bad request error.
     *
     * @param string $message
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return void
     */
    public function errorBadRequest($message = 'Bad Request')
    {
        $this->error($message, 400);
    }

    /**
     * Return a 403 forbidden error.
     *
     * @param string $message
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return void
     */
    public function errorForbidden($message = 'Forbidden')
    {
        $this->error($message, 403);
    }

    /**
     * Return a 500 internal server error.
     *
     * @param string $message
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return void
     */
    public function errorInternal($message = 'Internal Error')
    {
        $this->error($message, 500);
    }

    /**
     * Return a 401 unauthorized error.
     *
     * @param string $message
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return void
     */
    public function errorUnauthorized($message = 'Unauthorized')
    {
        $this->error($message, 401);
    }

    /**
     * Return a 405 method not allowed error.
     *
     * @param string $message
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return void
     */
    public function errorMethodNotAllowed($message = 'Method Not Allowed')
    {
        $this->error($message, 405);
    }

    /**
     * Call magic methods beginning with "with".
     *
     * @param string $method
     * @param array  $parameters
     *
     * @throws \ErrorException
     *
     * @return mixed
     */
    public function __call($method, $parameters)
    {
        if (Str::startsWith($method, 'with')) {
            return call_user_func_array([$this, Str::camel(substr($method, 4))], $parameters);

        // Because PHP won't let us name the method "array" we'll simply watch for it
            // in here and return the new binding. Gross. This is now DEPRECATED and
            // should not be used. Just return an array or a new response instance.
        } elseif ($method == 'array') {
            return new Response($parameters[0]);
        }

        throw new ErrorException('Undefined method '.get_class($this).'::'.$method);
    }
}


================================================
FILE: src/Http/Response/Format/Format.php
================================================
<?php

namespace Dingo\Api\Http\Response\Format;

abstract class Format
{
    /**
     * Illuminate request instance.
     *
     * @var \Illuminate\Http\Request
     */
    protected $request;

    /**
     * Illuminate response instance.
     *
     * @var \Illuminate\Http\Response
     */
    protected $response;

    /*
     * Array of formats' options.
     *
     * @var array
     */
    protected $options;

    /**
     * Set the request instance.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return \Dingo\Api\Http\Response\Format\Format
     */
    public function setRequest($request)
    {
        $this->request = $request;

        return $this;
    }

    /**
     * Set the response instance.
     *
     * @param \Illuminate\Http\Response $response
     *
     * @return \Dingo\Api\Http\Response\Format\Format
     */
    public function setResponse($response)
    {
        $this->response = $response;

        return $this;
    }

    /**
     * Set the formats' options.
     *
     * @param array $options
     *
     * @return \Dingo\Api\Http\Response\Format\Format
     */
    public function setOptions(array $options)
    {
        $this->options = $options;

        return $this;
    }

    /**
     * Format an Eloquent model.
     *
     * @param \Illuminate\Database\Eloquent\Model $model
     *
     * @return string
     */
    abstract public function formatEloquentModel($model);

    /**
     * Format an Eloquent collection.
     *
     * @param \Illuminate\Database\Eloquent\Collection $collection
     *
     * @return string
     */
    abstract public function formatEloquentCollection($collection);

    /**
     * Format an array or instance implementing Arrayable.
     *
     * @param array|\Illuminate\Contracts\Support\Arrayable $content
     *
     * @return string
     */
    abstract public function formatArray($content);

    /**
     * Get the response content type.
     *
     * @return string
     */
    abstract public function getContentType();
}


================================================
FILE: src/Http/Response/Format/Json.php
================================================
<?php

namespace Dingo\Api\Http\Response\Format;

use Illuminate\Support\Str;
use Illuminate\Contracts\Support\Arrayable;

class Json extends Format
{
    /*
     * JSON format (as well as JSONP) uses JsonOptionalFormatting trait, which
     * provides extra functionality for the process of encoding data to
     * its JSON representation.
     */
    use JsonOptionalFormatting;

    /**
     * Format an Eloquent model.
     *
     * @param \Illuminate\Database\Eloquent\Model $model
     *
     * @return string
     */
    public function formatEloquentModel($model)
    {
        $key = Str::singular($model->getTable());

        if (! $model::$snakeAttributes) {
            $key = Str::camel($key);
        }

        return $this->encode([$key => $model->toArray()]);
    }

    /**
     * Format an Eloquent collection.
     *
     * @param \Illuminate\Database\Eloquent\Collection $collection
     *
     * @return string
     */
    public function formatEloquentCollection($collection)
    {
        if ($collection->isEmpty()) {
            return $this->encode([]);
        }

        $model = $collection->first();
        $key = Str::plural($model->getTable());

        if (! $model::$snakeAttributes) {
            $key = Str::camel($key);
        }

        return $this->encode([$key => $collection->toArray()]);
    }

    /**
     * Format an array or instance implementing Arrayable.
     *
     * @param array|\Illuminate\Contracts\Support\Arrayable $content
     *
     * @return string
     */
    public function formatArray($content)
    {
        $content = $this->morphToArray($content);

        array_walk_recursive($content, function (&$value) {
            $value = $this->morphToArray($value);
        });

        return $this->encode($content);
    }

    /**
     * Get the response content type.
     *
     * @return string
     */
    public function getContentType()
    {
        return 'application/json';
    }

    /**
     * Morph a value to an array.
     *
     * @param array|\Illuminate\Contracts\Support\Arrayable $value
     *
     * @return array
     */
    protected function morphToArray($value)
    {
        return $value instanceof Arrayable ? $value->toArray() : $value;
    }

    /**
     * Encode the content to its JSON representation.
     *
     * @param mixed $content
     *
     * @return string
     */
    protected function encode($content)
    {
        $jsonEncodeOptions = [];

        // Here is a place, where any available JSON encoding options, that
        // deal with users' requirements to JSON response formatting and
        // structure, can be conveniently applied to tweak the output.

        if ($this->isJsonPrettyPrintEnabled()) {
            $jsonEncodeOptions[] = JSON_PRETTY_PRINT;
            $jsonEncodeOptions[] = JSON_UNESCAPED_UNICODE;
        }

        $encodedString = $this->performJsonEncoding($content, $jsonEncodeOptions);

        if ($this->isCustomIndentStyleRequired()) {
            $encodedString = $this->indentPrettyPrintedJson(
                $encodedString,
                $this->options['indent_style']
            );
        }

        return $encodedString;
    }
}


================================================
FILE: src/Http/Response/Format/JsonOptionalFormatting.php
================================================
<?php

namespace Dingo\Api\Http\Response\Format;

trait JsonOptionalFormatting
{
    /*
     * Supported JSON pretty print indent styles.
     *
     * @var array
     */
    protected $indentStyles = [
        'tab',
        'space',
    ];

    /*
     * Indent styles, that are allowed to have various indent size.
     *
     * @var array
     */
    protected $hasVariousIndentSize = [
        'space',
    ];

    /*
     * Indent chars, associated with indent styles.
     *
     * @var array
     */
    protected $indentChars = [
        'tab' => "\t",
        'space' => ' ',
    ];

    /*
     * JSON constants, that are allowed to be used as options while encoding.
     * Whitelist can be extended by other options in the future.
     *
     * @see http://php.net/manual/ru/json.constants.php
     *
     * @var array
     */
    protected $jsonEncodeOptionsWhitelist = [
        JSON_PRETTY_PRINT,
        JSON_UNESCAPED_UNICODE,
    ];

    /**
     * Determine if JSON pretty print option is set to true.
     *
     * @return bool
     */
    protected function isJsonPrettyPrintEnabled()
    {
        return isset($this->options['pretty_print']) && $this->options['pretty_print'] === true;
    }

    /**
     * Determine if JSON custom indent style is set.
     *
     * @return bool
     */
    protected function isCustomIndentStyleRequired()
    {
        return $this->isJsonPrettyPrintEnabled() &&
            isset($this->options['indent_style']) &&
            in_array($this->options['indent_style'], $this->indentStyles);
    }

    /**
     * Perform JSON encode.
     *
     * @param string $content
     * @param array  $jsonEncodeOptions
     *
     * @return string
     */
    protected function performJsonEncoding($content, array $jsonEncodeOptions = [])
    {
        $jsonEncodeOptions = $this->filterJsonEncodeOptions($jsonEncodeOptions);

        $optionsBitmask = $this->calucateJsonEncodeOptionsBitmask($jsonEncodeOptions);

        if (($encodedString = json_encode($content, $optionsBitmask)) === false) {
            throw new \ErrorException('Error encoding data in JSON format: '.json_last_error());
        }

        return $encodedString;
    }

    /**
     * Filter JSON encode options array against the whitelist array.
     *
     * @param array $jsonEncodeOptions
     *
     * @return array
     */
    protected function filterJsonEncodeOptions(array $jsonEncodeOptions)
    {
        return array_intersect($jsonEncodeOptions, $this->jsonEncodeOptionsWhitelist);
    }

    /**
     * Sweep JSON encode options together to get options' bitmask.
     *
     * @param array $jsonEncodeOptions
     *
     * @return int
     */
    protected function calucateJsonEncodeOptionsBitmask(array $jsonEncodeOptions)
    {
        return array_sum($jsonEncodeOptions);
    }

    /**
     * Indent pretty printed JSON string, using given indent style.
     *
     * @param string $jsonString
     * @param string $indentStyle
     * @param int    $defaultIndentSize
     *
     * @return string
     */
    protected function indentPrettyPrintedJson($jsonString, $indentStyle, $defaultIndentSize = 2)
    {
        $indentChar = $this->getIndentCharForIndentStyle($indentStyle);
        $indentSize = $this->getPrettyPrintIndentSize() ?: $defaultIndentSize;

        // If the given indentation style is allowed to have various indent size
        // (number of chars, that are used to indent one level in each line),
        // indent the JSON string with given (or default) indent size.
        if ($this->hasVariousIndentSize($indentStyle)) {
            return $this->peformIndentation($jsonString, $indentChar, $indentSize);
        }

        // Otherwise following the convention, that indent styles, that does not
        // allowed to have various indent size (e.g. tab) are indented using
        // one tabulation character per one indent level in each line.
        return $this->peformIndentation($jsonString, $indentChar);
    }

    /**
     * Get indent char for given indent style.
     *
     * @param string $indentStyle
     *
     * @return string
     */
    protected function getIndentCharForIndentStyle($indentStyle)
    {
        return $this->indentChars[$indentStyle];
    }

    /**
     * Get indent size for pretty printed JSON string.
     *
     * @return int|null
     */
    protected function getPrettyPrintIndentSize()
    {
        return isset($this->options['indent_size'])
            ? (int) $this->options['indent_size']
            : null;
    }

    /**
     * Determine if indent style is allowed to have various indent size.
     *
     * @param string $indentStyle
     *
     * @return bool
     */
    protected function hasVariousIndentSize($indentStyle)
    {
        return in_array($indentStyle, $this->hasVariousIndentSize);
    }

    /**
     * Perform indentation for pretty printed JSON string with a given
     * indent char, repeated N times, as determined by indent size.
     *
     * @param string $jsonString    JSON string, which must be indented
     * @param string $indentChar    Char, used for indent (default is tab)
     * @param int    $indentSize    Number of times to repeat indent char per one indent level
     * @param int    $defaultSpaces Default number of indent spaces after json_encode()
     *
     * @return string
     */
    protected function peformIndentation($jsonString, $indentChar = "\t", $indentSize = 1, $defaultSpaces = 4)
    {
        $pattern = '/(^|\G) {'.$defaultSpaces.'}/m';
        $replacement = str_repeat($indentChar, $indentSize).'$1';

        return preg_replace($pattern, $replacement, $jsonString);
    }
}


================================================
FILE: src/Http/Response/Format/Jsonp.php
================================================
<?php

namespace Dingo\Api\Http\Response\Format;

class Jsonp extends Json
{
    /**
     * Name of JSONP callback parameter.
     *
     * @var string
     */
    protected $callbackName = 'callback';

    /**
     * Create a new JSONP response formatter instance.
     *
     * @param string $callbackName
     *
     * @return void
     */
    public function __construct($callbackName = 'callback')
    {
        $this->callbackName = $callbackName;
    }

    /**
     * Determine if a callback is valid.
     *
     * @return bool
     */
    protected function hasValidCallback()
    {
        return $this->request->query->has($this->callbackName);
    }

    /**
     * Get the callback from the query string.
     *
     * @return string
     */
    protected function getCallback()
    {
        return $this->request->query->get($this->callbackName);
    }

    /**
     * Get the response content type.
     *
     * @return string
     */
    public function getContentType()
    {
        if ($this->hasValidCallback()) {
            return 'application/javascript';
        }

        return parent::getContentType();
    }

    /**
     * Encode the content to its JSONP representation.
     *
     * @param mixed $content
     *
     * @return string
     */
    protected function encode($content)
    {
        $jsonString = parent::encode($content);

        if ($this->hasValidCallback()) {
            return sprintf('%s(%s);', $this->getCallback(), $jsonString);
        }

        return $jsonString;
    }
}


================================================
FILE: src/Http/Response.php
================================================
<?php

namespace Dingo\Api\Http;

use ArrayObject;
use Illuminate\Support\Str;
use UnexpectedValueException;
use Illuminate\Http\JsonResponse;
use Dingo\Api\Transformer\Binding;
use Dingo\Api\Event\ResponseIsMorphing;
use Dingo\Api\Event\ResponseWasMorphed;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Http\Response as IlluminateResponse;
use Dingo\Api\Transformer\Factory as TransformerFactory;
use Illuminate\Database\Eloquent\Model as EloquentModel;
use Illuminate\Contracts\Events\Dispatcher as EventDispatcher;
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException;

class Response extends IlluminateResponse
{
    /**
     * The exception that triggered the error response.
     *
     * @var \Exception
     */
    public $exception;

    /**
     * Transformer binding instance.
     *
     * @var \Dingo\Api\Transformer\Binding
     */
    protected $binding;

    /**
     * Array of registered formatters.
     *
     * @var array
     */
    protected static $formatters = [];

    /**
     * Array of formats' options.
     *
     * @var array
     */
    protected static $formatsOptions = [];

    /**
     * Transformer factory instance.
     *
     * @var \Dingo\Api\Transformer\TransformerFactory
     */
    protected static $transformer;

    /**
     * Event dispatcher instance.
     *
     * @var \Illuminate\Contracts\Events\Dispatcher
     */
    protected static $events;

    /**
     * Create a new response instance.
     *
     * @param mixed                          $content
     * @param int                            $status
     * @param array                          $headers
     * @param \Dingo\Api\Transformer\Binding $binding
     *
     * @return void
     */
    public function __construct($content, $status = 200, $headers = [], Binding $binding = null)
    {
        parent::__construct($content, $status, $headers);

        $this->binding = $binding;
    }

    /**
     * Make an API response from an existing Illuminate response.
     *
     * @param \Illuminate\Http\Response $old
     *
     * @return \Dingo\Api\Http\Response
     */
    public static function makeFromExisting(IlluminateResponse $old)
    {
        $new = new static($old->getOriginalContent(), $old->getStatusCode());

        $new->headers = $old->headers;

        return $new;
    }

    /**
     * Make an API response from an existing JSON response.
     *
     * @param \Illuminate\Http\JsonResponse $json
     *
     * @return \Dingo\Api\Http\Response
     */
    public static function makeFromJson(JsonResponse $json)
    {
        $content = $json->getContent();

        // If the contents of the JsonResponse does not starts with /**/ (typical laravel jsonp response)
        // we assume that it is a valid json response that can be decoded, or we just use the raw jsonp
        // contents for building the response
        if (! Str::startsWith($json->getContent(), '/**/')) {
            $content = json_decode($json->getContent(), true);
        }

        $new = new static($content, $json->getStatusCode());

        $new->headers = $json->headers;

        return $new;
    }

    /**
     * Morph the API response to the appropriate format.
     *
     * @param string $format
     *
     * @return \Dingo\Api\Http\Response
     */
    public function morph($format = 'json')
    {
        $this->content = $this->getOriginalContent();

        $this->fireMorphingEvent();

        if (isset(static::$transformer) && static::$transformer->transformableResponse($this->content)) {
            $this->content = static::$transformer->transform($this->content);
        }

        $formatter = static::getFormatter($format);

        $formatter->setOptions(static::getFormatsOptions($format));

        $defaultContentType = $this->headers->get('Content-Type');

        // If we have no content, we don't want to set this header, as it will be blank
        $contentType = $formatter->getContentType();
        if (! empty($contentType)) {
            $this->headers->set('Content-Type', $formatter->getContentType());
        }

        $this->fireMorphedEvent();

        if ($this->content instanceof EloquentModel) {
            $this->content = $formatter->formatEloquentModel($this->content);
        } elseif ($this->content instanceof EloquentCollection) {
            $this->content = $formatter->formatEloquentCollection($this->content);
        } elseif (is_array($this->content) || $this->content instanceof ArrayObject || $this->content instanceof Arrayable) {
            $this->content = $formatter->formatArray($this->content);
        } else {
            if (! empty($defaultContentType)) {
                $this->headers->set('Content-Type', $defaultContentType);
            }
        }

        return $this;
    }

    /**
     * Fire the morphed event.
     *
     * @return void
     */
    protected function fireMorphedEvent()
    {
        if (! static::$events) {
            return;
        }

        static::$events->dispatch(new ResponseWasMorphed($this, $this->content));
    }

    /**
     * Fire the morphing event.
     *
     * @return void
     */
    protected function fireMorphingEvent()
    {
        if (! static::$events) {
            return;
        }

        static::$events->dispatch(new ResponseIsMorphing($this, $this->content));
    }

    /**
     * {@inheritdoc}
     */
    public function setContent($content)
    {
        // Attempt to set the content string, if we encounter an unexpected value
        // then we most likely have an object that cannot be type cast. In that
        // case we'll simply leave the content as null and set the original
        // content value and continue.
        if (! empty($content) && is_object($content) && ! $this->shouldBeJson($content)) {
            $this->original = $content;

            return $this;
        }

        try {
            return parent::setContent($content);
        } catch (UnexpectedValueException $exception) {
            $this->original = $content;

            return $this;
        }
    }

    /**
     * Set the event dispatcher instance.
     *
     * @param \Illuminate\Contracts\Events\Dispatcher $events
     *
     * @return void
     */
    public static function setEventDispatcher(EventDispatcher $events)
    {
        static::$events = $events;
    }

    /**
     * Get the formatter based on the requested format type.
     *
     * @param string $format
     *
     * @throws \RuntimeException
     *
     * @return \Dingo\Api\Http\Response\Format\Format
     */
    public static function getFormatter($format)
    {
        if (! static::hasFormatter($format)) {
            throw new NotAcceptableHttpException('Unable to format response according to Accept header.');
        }

        return static::$formatters[$format];
    }

    /**
     * Determine if a response formatter has been registered.
     *
     * @param string $format
     *
     * @return bool
     */
    public static function hasFormatter($format)
    {
        return isset(static::$formatters[$format]);
    }

    /**
     * Set the response formatters.
     *
     * @param array $formatters
     *
     * @return void
     */
    public static function setFormatters(array $formatters)
    {
        static::$formatters = $formatters;
    }

    /**
     * Set the formats' options.
     *
     * @param array $formatsOptions
     *
     * @return void
     */
    public static function setFormatsOptions(array $formatsOptions)
    {
        static::$formatsOptions = $formatsOptions;
    }

    /**
     * Get the format's options.
     *
     * @param string $format
     *
     * @return array
     */
    public static function getFormatsOptions($format)
    {
        if (! static::hasOptionsForFormat($format)) {
            return [];
        }

        return static::$formatsOptions[$format];
    }

    /**
     * Determine if any format's options were set.
     *
     * @param string $format
     *
     * @return bool
     */
    public static function hasOptionsForFormat($format)
    {
        return isset(static::$formatsOptions[$format]);
    }

    /**
     * Add a response formatter.
     *
     * @param string                                 $key
     * @param \Dingo\Api\Http\Response\Format\Format $formatter
     *
     * @return void
     */
    public static function addFormatter($key, $formatter)
    {
        static::$formatters[$key] = $formatter;
    }

    /**
     * Set the transformer factory instance.
     *
     * @param \Dingo\Api\Transformer\Factory $transformer
     *
     * @return void
     */
    public static function setTransformer(TransformerFactory $transformer)
    {
        static::$transformer = $transformer;
    }

    /**
     * Get the transformer instance.
     *
     * @return \Dingo\Api\Transformer\Factory
     */
    public static function getTransformer()
    {
        return static::$transformer;
    }

    /**
     * Add a meta key and value pair.
     *
     * @param string $key
     * @param mixed  $value
     *
     * @return \Dingo\Api\Http\Response
     */
    public function addMeta($key, $value)
    {
        $this->binding->addMeta($key, $value);

        return $this;
    }

    /**
     * Add a meta key and value pair.
     *
     * @param string $key
     * @param mixed  $value
     *
     * @return \Dingo\Api\Http\Response
     */
    public function meta($key, $value)
    {
        return $this->addMeta($key, $value);
    }

    /**
     * Set the meta data for the response.
     *
     * @param array $meta
     *
     * @return \Dingo\Api\Http\Response
     */
    public function setMeta(array $meta)
    {
        $this->binding->setMeta($meta);

        return $this;
    }

    /**
     * Get the meta data for the response.
     *
     * @return array
     */
    public function getMeta()
    {
        return $this->binding->getMeta();
    }

    /**
     * Add a cookie to the response.
     *
     * @param \Symfony\Component\HttpFoundation\Cookie|mixed $cookie
     *
     * @return \Dingo\Api\Http\Response
     */
    public function cookie($cookie)
    {
        return $this->withCookie($cookie);
    }

    /**
     * Add a header to the response.
     *
     * @param string $key
     * @param string $value
     * @param bool   $replace
     *
     * @return \Dingo\Api\Http\Response
     */
    public function withHeader($key, $value, $replace = true)
    {
        return $this->header($key, $value, $replace);
    }

    /**
     * Set the response status code.
     *
     * @param int $statusCode
     *
     * @return \Dingo\Api\Http\Response
     */
    public function statusCode($statusCode)
    {
        return $this->setStatusCode($statusCode);
    }
}


================================================
FILE: src/Http/Validation/Accept.php
================================================
<?php

namespace Dingo\Api\Http\Validation;

use Illuminate\Http\Request;
use Dingo\Api\Contract\Http\Validator;
use Dingo\Api\Http\Parser\Accept as AcceptParser;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;

class Accept implements Validator
{
    /**
     * Accept parser instance.
     *
     * @var \Dingo\Api\Http\Parser\Accept
     */
    protected $accept;

    /**
     * Indicates if the accept matching is strict.
     *
     * @var bool
     */
    protected $strict;

    /**
     * Create a new accept validator instance.
     *
     * @param \Dingo\Api\Http\Parser\Accept $accept
     * @param bool                          $strict
     *
     * @return void
     */
    public function __construct(AcceptParser $accept, $strict = false)
    {
        $this->accept = $accept;
        $this->strict = $strict;
    }

    /**
     * Validate the accept header on the request. If this fails it will throw
     * an HTTP exception that will be caught by the middleware. This
     * validator should always be run last and must not return
     * a success boolean.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @throws \Exception|\Symfony\Component\HttpKernel\Exception\BadRequestHttpException
     *
     * @return bool
     */
    public function validate(Request $request)
    {
        try {
            $this->accept->parse($request, $this->strict);
        } catch (BadRequestHttpException $exception) {
            if ($request->getMethod() === 'OPTIONS') {
                return true;
            }

            throw $exception;
        }
    }
}


================================================
FILE: src/Http/Validation/Domain.php
================================================
<?php

namespace Dingo\Api\Http\Validation;

use Illuminate\support\Str;
use Illuminate\Http\Request;
use Dingo\Api\Contract\Http\Validator;

class Domain implements Validator
{
    const PATTERN_STRIP_PROTOCOL = '/:\d*$/';

    /**
     * API domain.
     *
     * @var string
     */
    protected $domain;

    /**
     * Create a new domain validator instance.
     *
     * @param string $domain
     *
     * @return void
     */
    public function __construct($domain)
    {
        $this->domain = $domain;
    }

    /**
     * Validate that the request domain matches the configured domain.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return bool
     */
    public function validate(Request $request)
    {
        return ! is_null($this->domain) && $request->getHost() === $this->getStrippedDomain();
    }

    /**
     * Strip the protocol from a domain.
     *
     * @param string $domain
     *
     * @return string
     */
    protected function stripProtocol($domain)
    {
        if (Str::contains($domain, '://')) {
            $domain = substr($domain, strpos($domain, '://') + 3);
        }

        return $domain;
    }

    /**
     * Strip the port from a domain.
     *
     * @param $domain
     *
     * @return mixed
     */
    protected function stripPort($domain)
    {
        if ($domainStripped = preg_replace(self::PATTERN_STRIP_PROTOCOL, null, $domain)) {
            return $domainStripped;
        }

        return $domain;
    }

    /**
     * Get the domain stripped from protocol and port.
     *
     * @return mixed
     */
    protected function getStrippedDomain()
    {
        return $this->stripPort($this->stripProtocol($this->domain));
    }
}


================================================
FILE: src/Http/Validation/Prefix.php
================================================
<?php

namespace Dingo\Api\Http\Validation;

use Illuminate\Http\Request;
use Dingo\Api\Contract\Http\Validator;

class Prefix implements Validator
{
    /**
     * API prefix.
     *
     * @var string
     */
    protected $prefix;

    /**
     * Create a new prefix validator instance.
     *
     * @param string $prefix
     *
     * @return void
     */
    public function __construct($prefix)
    {
        $this->prefix = $prefix;
    }

    /**
     * Validate the request has a prefix and if it matches the configured
     * API prefix.
     *
     * @param \Illuminate\Http\Request $request
     *
     * @return bool
     */
    public function validate(Request $request)
    {
        $prefix = $this->filterAndExplode($this->prefix);

        $path = $this->filterAndExplode($request->getPathInfo());

        return ! is_null($this->prefix) && $prefix == array_slice($path, 0, count($prefix));
    }

    /**
     * Explode array on slash and remove empty values.
     *
     * @param array $array
     *
     * @return array
     */
    protected function filterAndExplode($array)
    {
        return array_filter(explode('/', $array));
    }
}


================================================
FILE: src/Provider/DingoServiceProvider.php
================================================
<?php

namespace Dingo\Api\Provider;

use RuntimeException;
use Dingo\Api\Auth\Auth;
use Dingo\Api\Dispatcher;
use Dingo\Api\Http\Request;
use Dingo\Api\Http\Response;
use Dingo\Api\Console\Command;
use Dingo\Api\Exception\Handler as ExceptionHandler;
use Dingo\Api\Transformer\Factory as TransformerFactory;

class DingoServiceProvider extends ServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        $this->setResponseStaticInstances();

        Request::setAcceptParser($this->app[\Dingo\Api\Http\Parser\Accept::class]);

        $this->app->rebinding('api.routes', function ($app, $routes) {
            $app['api.url']->setRouteCollections($routes);
        });
    }

    protected function setResponseStaticInstances()
    {
        Response::setFormatters($this->config('formats'));
        Response::setFormatsOptions($this->config('formatsOptions'));
        Response::setTransformer($this->app['api.transformer']);
        Response::setEventDispatcher($this->app['events']);
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->registerConfig();

        $this->registerClassAliases();

        $this->app->register(RoutingServiceProvider::class);

        $this->app->register(HttpServiceProvider::class);

        $this->registerExceptionHandler();

        $this->registerDispatcher();

        $this->registerAuth();

        $this->registerTransformer();

        $this->registerDocsCommand();

        if (class_exists('Illuminate\Foundation\Application', false)) {
            $this->commands([
                \Dingo\Api\Console\Command\Cache::class,
                \Dingo\Api\Console\Command\Routes::class,
            ]);
        }
    }

    /**
     * Register the configuration.
     *
     * @return void
     */
    protected function registerConfig()
    {
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/api.php'), 'api');

        if (! $this->app->runningInConsole() && empty($this->config('prefix')) && empty($this->config('domain'))) {
            throw new RuntimeException('Unable to boot ApiServiceProvider, configure an API domain or prefix.');
        }
    }

    /**
     * Register the class aliases.
     *
     * @return void
     */
    protected function registerClassAliases()
    {
        $serviceAliases = [
            \Dingo\Api\Http\Request::class => \Dingo\Api\Contract\Http\Request::class,
            'api.dispatcher' => \Dingo\Api\Dispatcher::class,
            'api.http.validator' => \Dingo\Api\Http\RequestValidator::class,
            'api.http.response' => \Dingo\Api\Http\Response\Factory::class,
            'api.router' => \Dingo\Api\Routing\Router::class,
            'api.router.adapter' => \Dingo\Api\Contract\Routing\Adapter::class,
            'api.auth' => \Dingo\Api\Auth\Auth::class,
            'api.limiting' => \Dingo\Api\Http\RateLimit\Handler::class,
            'api.transformer' => \Dingo\Api\Transformer\Factory::class,
            'api.url' => \Dingo\Api\Routing\UrlGenerator::class,
            'api.exception' => [\Dingo\Api\Exception\Handler::class, \Dingo\Api\Contract\Debug\ExceptionHandler::class],
        ];

        foreach ($serviceAliases as $key => $aliases) {
            foreach ((array) $aliases as $alias) {
                $this->app->alias($key, $alias);
            }
        }
    }

    /**
     * Register the exception handler.
     *
     * @return void
     */
    protected function registerExceptionHandler()
    {
        $this->app->singleton('api.exception', function ($app) {
            return new ExceptionHandler($app['Illuminate\Contracts\Debug\ExceptionHandler'], $this->config('errorFormat'), $this->config('debug'));
        });
    }

    /**
     * Register the internal dispatcher.
     *
     * @return void
     */
    public function registerDispatcher()
    {
        $this->app->singleton('api.dispatcher', function ($app) {
            $dispatcher = new Dispatcher($app, $app['files'], $app[\Dingo\Api\Routing\Router::class], $app[\Dingo\Api\Auth\Auth::class]);

            $dispatcher->setSubtype($this->config('subtype'));
            $dispatcher->setStandardsTree($this->config('standardsTree'));
            $dispatcher->setPrefix($this->config('prefix'));
            $dispatcher->setDefaultVersion($this->config('version'));
            $dispatcher->setDefaultDomain($this->config('domain'));
            $dispatcher->setDefaultFormat($this->config('defaultFormat'));

            return $dispatcher;
        });
    }

    /**
     * Register the auth.
     *
     * @return void
     */
    protected function registerAuth()
    {
        $this->app->singleton('api.auth', function ($app) {
            return new Auth($app[\Dingo\Api\Routing\Router::class], $app, $this->config('auth'));
        });
    }

    /**
     * Register the transformer factory.
     *
     * @return void
     */
    protected function registerTransformer()
    {
        $this->app->singleton('api.transformer', function ($app) {
            return new TransformerFactory($app, $this->config('transformer'));
        });
    }

    /**
     * Register the documentation command.
     *
     * @return void
     */
    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]);
    }
}


================================================
FILE: src/Provider/HttpServiceProvider.php
================================================
<?php

namespace Dingo\Api\Provider;

use Dingo\Api\Auth\Auth;
use Dingo\Api\Routing\Router;
use Dingo\Api\Http\Middleware;
use Dingo\Api\Http\Validation;
use Dingo\Api\Transformer\Factory;
use Dingo\Api\Http\RequestValidator;
use Dingo\Api\Http\RateLimit\Handler;
use Dingo\Api\Http\Validation\Accept;
use Dingo\Api\Http\Validation\Domain;
use Dingo\Api\Http\Validation\Prefix;
use Dingo\Api\Http\Middleware\Request;
use Dingo\Api\Http\Middleware\RateLimit;
use Dingo\Api\Contract\Debug\ExceptionHandler;
use Dingo\Api\Http\Middleware\PrepareController;
use Dingo\Api\Http\Parser\Accept as AcceptParser;
use Dingo\Api\Http\Middleware\Auth as AuthMiddleware;
use Dingo\Api\Http\Response\Factory as ResponseFactory;
use Dingo\Api\Http\RateLimit\Handler as RateLimitHandler;

class HttpServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->registerRateLimiting();

        $this->registerHttpValidation();

        $this->registerHttpParsers();

        $this->registerResponseFactory();

        $this->registerMiddleware();
    }

    /**
     * Register the rate limiting.
     *
     * @return void
     */
    protected function registerRateLimiting()
    {
        $this->app->singleton('api.limiting', function ($app) {
            return new RateLimitHandler($app, $app['cache'], $this->config('throttling'));
        });
    }

    /**
     * Register the HTTP validation.
     *
     * @return void
     */
    protected function registerHttpValidation()
    {
        $this->app->singleton('api.http.validator', function ($app) {
            return new RequestValidator($app);
        });

        $this->app->singleton(Domain::class, function ($app) {
            return new Validation\Domain($this->config('domain'));
        });

        $this->app->singleton(Prefix::class, function ($app) {
            return new Validation\Prefix($this->config('prefix'));
        });

        $this->app->singleton(Accept::class, function ($app) {
            return new Validation\Accept(
                $this->app[AcceptParser::class],
                $this->config('strict')
            );
        });
    }

    /**
     * Register the HTTP parsers.
     *
     * @return void
     */
    protected function registerHttpParsers()
    {
        $this->app->singleton(AcceptParser::class, function ($app) {
            return new AcceptParser(
                $this->config('standardsTree'),
                $this->config('subtype'),
                $this->config('version'),
                $this->config('defaultFormat')
            );
        });
    }

    /**
     * Register the response factory.
     *
     * @return void
     */
    protected function registerResponseFactory()
    {
        $this->app->singleton('api.http.response', function ($app) {
            return new ResponseFactory($app[Factory::class]);
        });
    }

    /**
     * Register the middleware.
     *
     * @return void
     */
    protected function registerMiddleware()
    {
        $this->app->singleton(Request::class, function ($app) {
            $middleware = new Middleware\Request(
                $app,
                $app[ExceptionHandler::class],
                $app[Router::class],
                $app[RequestValidator::class],
                $app['events']
            );

            $middleware->setMiddlewares($this->config('middleware', false));

            return $middleware;
        });

        $this->app->singleton(AuthMiddleware::class, function ($app) {
            return new Middleware\Auth($app[Router::class], $app[Auth::class]);
        });

        $this->app->singleton(RateLimit::class, function ($app) {
            return new Middleware\RateLimit($app[Router::class], $app[Handler::class]);
        });

        $this->app->singleton(PrepareController::class, function ($app) {
            return new Middleware\PrepareController($app[Router::class]);
        });
    }
}


================================================
FILE: src/Provider/LaravelServiceProvider.php
================================================
<?php

namespace Dingo\Api\Provider;

use ReflectionClass;
use Dingo\Api\Http\FormRequest;
use Illuminate\Routing\Redirector;
use Dingo\Api\Http\Middleware\Auth;
use Illuminate\Contracts\Http\Kernel;
use Dingo\Api\Event\RequestWasMatched;
use Dingo\Api\Http\Middleware\Request;
use Illuminate\Foundation\Application;
use Dingo\Api\Http\Middleware\RateLimit;
use Illuminate\Routing\ControllerDispatcher;
use Dingo\Api\Http\Middleware\PrepareController;
use Illuminate\Http\Request as IlluminateRequest;
use Dingo\Api\Routing\Adapter\Laravel as LaravelAdapter;
use Illuminate\Contracts\Validation\ValidatesWhenResolved;

class LaravelServiceProvider extends DingoServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();

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

        $kernel = $this->app->make(Kernel::class);

        $this->app[Request::class]->mergeMiddlewares(
            $this->gatherAppMiddleware($kernel)
        );

        $this->addRequestMiddlewareToBeginning($kernel);

        $this->app['events']->listen(RequestWasMatched::class, function (RequestWasMatched $event) {
            $this->replaceRouteDispatcher();

            $this->updateRouterBindings();
        });

        // Originally Validate FormRequest after resolving
        /* This casues the prepareForValidation() function to be called twice, and seemingly has no other benefit, see discussion at
        https://github.com/dingo/api/issues/1668
        This is already done by laravel service provider, and works with Dingo router
        $this->app->afterResolving(ValidatesWhenResolved::class, function ($resolved) {
            $resolved->validateResolved();
        });
        */

        $this->app->resolving(FormRequest::class, function (FormRequest $request, Application $app) {
            $this->initializeRequest($request, $app['request']);

            $request->setContainer($app)->setRedirector($app->make(Redirector::class));
        });

        $this->addMiddlewareAlias('api.auth', Auth::class);
        $this->addMiddlewareAlias('api.throttle', RateLimit::class);
        $this->addMiddlewareAlias('api.controllers', PrepareController::class);
    }

    /**
     * Replace the route dispatcher.
     *
     * @return void
     */
    protected function replaceRouteDispatcher()
    {
        $this->app->singleton('illuminate.route.dispatcher', function ($app) {
            return new ControllerDispatcher($app['api.router.adapter']->getRouter(), $app);
        });
    }

    /**
     * Grab the bindings from the Laravel router and set them on the adapters
     * router.
     *
     * @return void
     */
    protected function updateRouterBindings()
    {
        foreach ($this->getRouterBindings() as $key => $binding) {
            $this->app['api.router.adapter']->getRouter()->bind($key, $binding);
        }
    }

    /**
     * Get the Laravel routers bindings.
     *
     * @return array
     */
    protected function getRouterBindings()
    {
        $property = (new ReflectionClass($this->app['router']))->getProperty('binders');
        $property->setAccessible(true);

        return $property->getValue($this->app['router']);
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        parent::register();

        $this->registerRouterAdapter();
    }

    /**
     * Register the router adapter.
     *
     * @return void
     */
    protected function registerRouterAdapter()
    {
        $this->app->singleton('api.router.adapter', function ($app) {
            return new LaravelAdapter($app['router']);
        });
    }

    /**
     * Add the request middleware to the beginning of the kernel.
     *
     * @param \Illuminate\Contracts\Http\Kernel $kernel
     *
     * @return void
     */
    protected function addRequestMiddlewareToBeginning(Kernel $kernel)
    {
        $kernel->prependMiddleware(Request::class);
    }

    /**
     * Register a short-hand name for a middleware. For compatibility
     * with Laravel < 5.4 check if aliasMiddleware exists since this
     * method has been renamed.
     *
     * @param string $name
     * @param string $class
     *
     * @return void
     */
    protected function addMiddlewareAlias($name, $class)
    {
        $router = $this->app['router'];

        if (method_exists($router, 'aliasMiddleware')) {
            return $router->aliasMiddleware($name, $class);
        }

        return $router->middleware($name, $class);
    }

    /**
     * Gather the application middleware besides this one so that we can send
     * our request through them, exactly how the developer wanted.
     *
     * @param \Illuminate\Contracts\Http\Kernel $kernel
     *
     * @return array
     */
    protected function gatherAppMiddleware(Kernel $kernel)
    {
        $property = (new ReflectionClass($kernel))->getProperty('middleware');
        $property->setAccessible(true);

        return $property->getValue($kernel);
    }

    /**
     * Initialize the form request with data from the given request.
     *
     * @param FormRequest $form
     * @param IlluminateRequest $current
     *
     * @return void
     */
    protected function initializeRequest(FormRequest $form, IlluminateRequest $current)
    {
        $files = $current->files->all();

        $files = is_array($files) ? array_filter($files) : $files;

        $form->initialize(
            $current->query->all(),
            $current->request->all(),
            $current->attributes->all(),
            $current->cookies->all(),
            $files,
            $current->server->all(),
            $current->getContent()
        );

        $form->setJson($current->json());

        if ($session = $current->getSession()) {
            $form->setLaravelSession($session);
        }

        $form->setUserResolver($current->getUserResolver());

        $form->setRouteResolver($current->getRouteResolver());
    }
}


================================================
FILE: src/Provider/LumenServiceProvider.php
================================================
<?php

namespace Dingo\Api\Provider;

use ReflectionClass;
use Laravel\Lumen\Application;
use Dingo\Api\Http\FormRequest;
use Laravel\Lumen\Http\Redirector;
use Dingo\Api\Http\Middleware\Auth;
use Dingo\Api\Http\Middleware\Request;
use Dingo\Api\Http\Middleware\RateLimit;
use FastRoute\Dispatcher\GroupCountBased;
use Dingo\Api\Http\Middleware\PrepareController;
use FastRoute\RouteParser\Std as StdRouteParser;
use Illuminate\Http\Request as IlluminateRequest;
use Dingo\Api\Routing\Adapter\Lumen as LumenAdapter;
use Illuminate\Contracts\Validation\ValidatesWhenResolved;
use FastRoute\DataGenerator\GroupCountBased as GcbDataGenerator;

class LumenServiceProvider extends DingoServiceProvider
{
    /**
     * Boot the service provider.
     *
     * @throws \ReflectionException
     *
     * @return void
     */
    public function boot()
    {
        parent::boot();

        $this->app->configure('api');

        $reflection = new ReflectionClass($this->app);

        $this->app[Request::class]->mergeMiddlewares(
            $this->gatherAppMiddleware($reflection)
        );

        $this->addRequestMiddlewareToBeginning($reflection);

        // Because Lumen sets the route resolver at a very weird point we're going to
        // have to use reflection whenever the request instance is rebound to
        // set the route resolver to get the current route.
        $this->app->rebinding(IlluminateRequest::class, function ($app, $request) {
            $request->setRouteResolver(function () use ($app) {
                $reflection = new ReflectionClass($app);

                $property = $reflection->getProperty('currentRoute');
                $property->setAccessible(true);

                return $property->getValue($app);
            });
        });

        // Validate FormRequest after resolving
        $this->app->afterResolving(ValidatesWhenResolved::class, function ($resolved) {
            $resolved->validateResolved();
        });

        $this->app->resolving(FormRequest::class, function (FormRequest $request, Application $app) {
            $this->initializeRequest($request, $app['request']);

            $request->setContainer($app)->setRedirector($app->make(Redirector::class));
        });

        $this->app->routeMiddleware([
            'api.auth' => Auth::class,
            'api.throttle' => RateLimit::class,
            'api.controllers' => PrepareController::class,
        ]);
    }

    /**
     * Setup the configuration.
     *
     * @return void
     */
    protected function setupConfig()
    {
        $this->app->configure('api');

        parent::setupConfig();
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        parent::register();

        $this->app->singleton('api.router.adapter', function ($app) {
            return new LumenAdapter($app, new StdRouteParser, new GcbDataGenerator, $this->getDispatcherResolver());
        });
    }

    /**
     * Get the dispatcher resolver callback.
     *
     * @return \Closure
     */
    protected function getDispatcherResolver()
    {
        return function ($routeCollector) {
            return new GroupCountBased($routeCollector->getData());
        };
    }

    /**
     * Add the request middleware to the beginning of the middleware stack on the
     * Lumen application instance.
     *
     * @param \ReflectionClass $reflection
     *
     * @return void
     */
    protected function addRequestMiddlewareToBeginning(ReflectionClass $reflection)
    {
        $property = $reflection->getProperty('middleware');
        $property->setAccessible(true);

        $middleware = $property->getValue($this->app);

        array_unshift($middleware, Request::class);

        $property->setValue($this->app, $middleware);
        $property->setAccessible(false);
    }

    /**
     * Gather the application middleware besides this one so that we can send
     * our request through them, exactly how the developer wanted.
     *
     * @param \ReflectionClass $reflection
     *
     * @return array
     */
    protected function gatherAppMiddleware(ReflectionClass $reflection)
    {
        $property = $reflection->getProperty('middleware');
        $property->setAccessible(true);

        $middleware = $property->getValue($this->app);

        return $middleware;
    }

    /**
     * Initialize the form request with data from the given request.
     *
     * @param FormRequest $form
     * @param IlluminateRequest $current
     *
     * @return void
     */
    protected function initializeRequest(FormRequest $form, IlluminateRequest $current)
    {
        $files = $current->files->all();

        $files = is_array($files) ? array_filter($files) : $files;

        $form->initialize(
            $current->query->all(),
            $current->request->all(),
            $current->attributes->all(),
            $current->cookies->all(),
            $files,
            $current->server->all(),
            $current->getContent()
        );

        $form->setJson($current->json());

        if ($session = $current->getSession()) {
            $form->setLaravelSession($session);
        }

        $form->setUserResolver($current->getUserResolver());

        $form->setRouteResolver($current->getRouteResolver());
    }
}


================================================
FILE: src/Provider/RoutingServiceProvider.php
================================================
<?php

namespace Dingo\Api\Provider;

use Dingo\Api\Routing\Router;
use Dingo\Api\Routing\UrlGenerator;
use Dingo\Api\Contract\Routing\Adapter;
use Dingo\Api\Routing\ResourceRegistrar;
use Dingo\Api\Contract\Debug\ExceptionHandler;

class RoutingServiceProvider extends ServiceProvider
{
    /**
     * Register the service provider.
     */
    public function register()
    {
        $this->registerRouter();

        $this->registerUrlGenerator();
    }

    /**
     * Register the router.
     */
    protected function registerRouter()
    {
        $this->app->singleton('api.router', function ($app) {
            $router = new Router(
                $app[Adapter::class],
                $app[ExceptionHandler::class],
                $app,
                $this->config('domain'),
                $this->config('prefix')
            );

            $router->setConditionalRequest($this->config('conditionalRequest'));

            return $router;
        });

        $this->app->singleton(ResourceRegistrar::class, function ($app) {
            return new ResourceRegistrar($app[Router::class]);
        });
    }

    /**
     * Register the URL generator.
     */
    protected function registerUrlGenerator()
    {
        $this->app->singleton('api.url', function ($app) {
            $url = new UrlGenerator($app['request']);

            $url->setRouteCollections($app[Router::class]->getRoutes());

            $url->setKeyResolver(function () {
                return $this->app->make('config')->get('app.key');
            });

            return $url;
        });
    }

    /**
     * Get the URL generator request rebinder.
     *
     * @return \Closure
     */
    private function requestRebinder()
    {
        return function ($app, $request) {
            $app['api.url']->setRequest($request);
        };
    }
}


================================================
FILE: src/Provider/ServiceProvider.php
================================================
<?php

namespace Dingo\Api\Provider;

use Illuminate\Support\ServiceProvider as IlluminateServiceProvider;

abstract class ServiceProvider extends IlluminateServiceProvider
{
    /**
     * Array of config items that are instantiable.
     *
     * @var array
     */
    protected $instantiable = [
        'middleware', 'auth', 'throttling', 'transformer', 'formats',
    ];

    /**
     * Retrieve and instantiate a config value if it exists and is a class.
     *
     * @param string $item
     * @param bool   $instantiate
     *
     * @return mixed
     */
    protected function config($item, $instantiate = true)
    {
        $value = $this->app['config']->get('api.'.$item);

        if (is_array($value)) {
            return $instantiate ? $this->instantiateConfigValues($item, $value) : $value;
        }

        return $instantiate ? $this->instantiateConfigValue($item, $value) : $value;
    }

    /**
     * Instantiate an array of instantiable configuration values.
     *
     * @param string $item
     * @param array  $values
     *
     * @return array
     */
    protected function instantiateConfigValues($item, array $values)
    {
        foreach ($values as $key => $value) {
            $values[$key] = $this->instantiateConfigValue($item, $value);
        }

        return $values;
    }

    /**
     * Instantiate an instantiable configuration value.
     *
     * @param string $item
     * @param mixed  $value
     *
     * @return mixed
     */
    protected function instantiateConfigValue($item, $value)
    {
        if (is_string($value) && in_array($item, $this->instantiable)) {
            return $this->app->make($value);
        }

        return $value;
    }
}


================================================
FILE: src/Routing/Adapter/Laravel.php
================================================
<?php

namespace Dingo\Api\Routing\Adapter;

use Dingo\Api\Contract\Routing\Adapter;
use Dingo\Api\Exception\UnknownVersionException;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Routing\RouteCollection;
use Illuminate\Routing\Router;

class Laravel implements Adapter
{
    /**
     * Application container instance.
     *
     * @var \Illuminate\Contracts\Container\Container
     */
    protected $container;

    /**
     * Laravel router instance.
     *
     * @var \Illuminate\Routing\Router
     */
    protected $router;

    /**
     * Array of registered routes.
     *
     * @var array
     */
    protected $routes = [];

    /**
     * Array of merged old routes and API routes.
     *
     * @var array
     */
    protected $mergedRoutes = [];

    /**
     * Routes already defined on the router.
     *
     * @var \Illuminate\Routing\RouteCollection
     */
    protected $oldRoutes;

    /**
     * The globally available parameter patterns.
     *
     * @var array
     */
    protected $patterns = [];

    /**
     * Create a new laravel routing adapter instance.
     *
     * @param \Illuminate\Routing\Router $router
     *
     * @return void
     */
    public function __construct(Router $router)
    {
        $this->router = $router;
    }

    /**
     * Dispatch a request.
     *
     * @param \Illuminate\Http\Request $request
     * @param string                   $version
     *
     * @return mixed
     */
    public function dispatch(Request $request, $version)
    {
        if (! isset($this->routes[$version])) {
            throw new UnknownVersionException;
        }

        $routes = $this->mergeOldRoutes($version);

        $this->router->setRoutes($routes);

        $router = clone $this->router;

        $response = $router->dispatch($request);

        unset($router);

        return $response;
    }

    /**
     * Merge the old application routes with the API routes.
     *
     * @param string $version
     *
     * @return array
     */
    protected function mergeOldRoutes($version)
    {
        if (! isset($this->oldRoutes)) {
            $this->oldRoutes = $this->router->getRoutes();
        }

        if (! isset($this->mergedRoutes[$version])) {
            $this->mergedRoutes[$version] = $this->routes[$version];

            foreach ($this->oldRoutes as $route) {
                $this->mergedRoutes[$version]->add($route);
            }

            $this->mergedRoutes[$version]->refreshNameLookups();
            $this->mergedRoutes[$version]->refreshActionLookups();
        }

        return $this->mergedRoutes[$version];
    }

    /**
     * Get the URI, methods, and action from the route.
     *
     * @param mixed                    $route
     * @param \Illuminate\Http\Request $request
     *
     * @return array
     */
    public function getRouteProperties($route, Request $request)
    {
        if (method_exists($route, 'uri') && method_exists($route, 'methods')) {
            return [$route->uri(), $route->methods(), $route->getAction()];
        }

        return [$route->getUri(), $route->getMethods(), $route->getAction()];
    }

    /**
     * Add a route to the appropriate route collection.
     *
     * @param array  $methods
     * @param array  $versions
     * @param string $uri
     * @param mixed  $action
     *
     * @return \Illuminate\Routing\Route
     */
    public function addRoute(array $methods, array $versions, $uri, $action)
    {
        $this->createRouteCollections($versions);

        // Add where-patterns from original laravel router
        $action['where'] = array_merge($this->router->getPatterns(), $action['where'] ?? []);

        $route = new Route($methods, $uri, $action);
        $route->where($action['where']);

        foreach ($versions as $version) {
            $this->routes[$version]->add($route);
        }

        return $route;
    }

    /**
     * Create the route collections for the versions.
     *
     * @param array $versions
     *
     * @return void
     */
    protected function createRouteCollections(array $versions)
    {
        foreach ($versions as $version) {
            if (! isset($this->routes[$version])) {
                $this->routes[$version] = new RouteCollection;
            }
        }
    }

    /**
     * Get all routes or only for a specific version.
     *
     * @param string $version
     *
     * @return mixed
     */
    public function getRoutes($version = null)
    {
        if (! is_null($version)) {
            return $this->routes[$version];
        }

        return $this->routes;
    }

    /**
     * Get a normalized iterable set of routes.
     *
     * @param string $version
     *
     * @return mixed
     */
    public function getIterableRoutes($version = null)
    {
        return $this->getRoutes($version);
    }

    /**
     * Set the routes on the adapter.
     *
     * @param array $routes
     *
     * @return void
     */
    public function setRoutes(array $routes)
    {
        $this->routes = $routes;
    }

    /**
     * Prepare a route for serialization.
     *
     * @param mixed $route
     *
     * @return mixed
     */
    public function prepareRouteForSerialization($route)
    {
        $route->prepareForSerialization();

        return $route;
    }

    /**
     * Gather the route middlewares.
     *
     * @param \Illuminate\Routing\Route $route
     *
     * @return array
     */
    public function gatherRouteMiddlewares($route)
    {
        if (method_exists($this->router, 'gatherRouteMiddleware')) {
            return $this->router->gatherRouteMiddleware($route);
        }

        return $this->router->gatherRouteMiddlewares($route);
    }

    /**
     * Get the Laravel router instance.
     *
     * @return \Illuminate\Routing\Router
     */
    public function getRouter()
    {
        return $this->router;
    }

    /**
     * Get the global "where" patterns.
     *
     * @return array
     */
    public function getPatterns()
    {
        return $this->patterns;
    }
}


================================================
FILE: src/Routing/Adapter/Lumen.php
================================================
<?php

namespace Dingo\Api\Routing\Adapter;

Download .txt
gitextract_9d3mtabi/

├── .editorconfig
├── .gitattributes
├── .github/
│   └── ISSUE_TEMPLATE.md
├── .gitignore
├── .styleci.yml
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── composer.json
├── config/
│   └── api.php
├── phpunit.xml.dist
├── readme.md
├── src/
│   ├── Auth/
│   │   ├── Auth.php
│   │   └── Provider/
│   │       ├── Authorization.php
│   │       ├── Basic.php
│   │       └── JWT.php
│   ├── Console/
│   │   └── Command/
│   │       ├── Cache.php
│   │       ├── Docs.php
│   │       └── Routes.php
│   ├── Contract/
│   │   ├── Auth/
│   │   │   └── Provider.php
│   │   ├── Debug/
│   │   │   ├── ExceptionHandler.php
│   │   │   └── MessageBagErrors.php
│   │   ├── Http/
│   │   │   ├── Parser.php
│   │   │   ├── RateLimit/
│   │   │   │   ├── HasRateLimiter.php
│   │   │   │   └── Throttle.php
│   │   │   ├── Request.php
│   │   │   └── Validator.php
│   │   ├── Routing/
│   │   │   └── Adapter.php
│   │   └── Transformer/
│   │       └── Adapter.php
│   ├── Dispatcher.php
│   ├── Event/
│   │   ├── RequestWasMatched.php
│   │   ├── ResponseIsMorphing.php
│   │   └── ResponseWasMorphed.php
│   ├── Exception/
│   │   ├── DeleteResourceFailedException.php
│   │   ├── Handler.php
│   │   ├── InternalHttpException.php
│   │   ├── RateLimitExceededException.php
│   │   ├── ResourceException.php
│   │   ├── StoreResourceFailedException.php
│   │   ├── UnknownVersionException.php
│   │   ├── UpdateResourceFailedException.php
│   │   └── ValidationHttpException.php
│   ├── Facade/
│   │   ├── API.php
│   │   └── Route.php
│   ├── Http/
│   │   ├── FormRequest.php
│   │   ├── InternalRequest.php
│   │   ├── Middleware/
│   │   │   ├── Auth.php
│   │   │   ├── PrepareController.php
│   │   │   ├── RateLimit.php
│   │   │   └── Request.php
│   │   ├── Parser/
│   │   │   └── Accept.php
│   │   ├── RateLimit/
│   │   │   ├── Handler.php
│   │   │   └── Throttle/
│   │   │       ├── Authenticated.php
│   │   │       ├── Route.php
│   │   │       ├── Throttle.php
│   │   │       └── Unauthenticated.php
│   │   ├── Request.php
│   │   ├── RequestValidator.php
│   │   ├── Response/
│   │   │   ├── Factory.php
│   │   │   └── Format/
│   │   │       ├── Format.php
│   │   │       ├── Json.php
│   │   │       ├── JsonOptionalFormatting.php
│   │   │       └── Jsonp.php
│   │   ├── Response.php
│   │   └── Validation/
│   │       ├── Accept.php
│   │       ├── Domain.php
│   │       └── Prefix.php
│   ├── Provider/
│   │   ├── DingoServiceProvider.php
│   │   ├── HttpServiceProvider.php
│   │   ├── LaravelServiceProvider.php
│   │   ├── LumenServiceProvider.php
│   │   ├── RoutingServiceProvider.php
│   │   └── ServiceProvider.php
│   ├── Routing/
│   │   ├── Adapter/
│   │   │   ├── Laravel.php
│   │   │   └── Lumen.php
│   │   ├── Helpers.php
│   │   ├── ResourceRegistrar.php
│   │   ├── Route.php
│   │   ├── RouteCollection.php
│   │   ├── Router.php
│   │   └── UrlGenerator.php
│   ├── Transformer/
│   │   ├── Adapter/
│   │   │   └── Fractal.php
│   │   ├── Binding.php
│   │   └── Factory.php
│   └── helpers.php
└── tests/
    ├── Auth/
    │   ├── AuthTest.php
    │   └── Provider/
    │       ├── AuthorizationTest.php
    │       ├── BasicTest.php
    │       └── JWTTest.php
    ├── BaseTestCase.php
    ├── ChecksLaravelVersionTrait.php
    ├── DispatcherTest.php
    ├── Exception/
    │   └── HandlerTest.php
    ├── Http/
    │   ├── Middleware/
    │   │   ├── AuthTest.php
    │   │   ├── RateLimitTest.php
    │   │   └── RequestTest.php
    │   ├── Parser/
    │   │   └── AcceptTest.php
    │   ├── RateLimit/
    │   │   ├── HandlerTest.php
    │   │   └── Throttle/
    │   │       ├── AuthenticatedTest.php
    │   │       └── UnauthenticatedTest.php
    │   ├── RequestValidatorTest.php
    │   ├── Response/
    │   │   ├── FactoryTest.php
    │   │   └── Format/
    │   │       ├── ExpectedPrettyPrintedJson/
    │   │       │   ├── testMorphingArrayWithEightSpacesPrettyPrintIndent.json.php
    │   │       │   ├── testMorphingArrayWithFourSpacesPrettyPrintIndent.json.php
    │   │       │   ├── testMorphingArrayWithOneTabPrettyPrintIndent.json.php
    │   │       │   └── testMorphingArrayWithTwoSpacesPrettyPrintIndent.json.php
    │   │       ├── ExpectedPrettyPrintedJsonp/
    │   │       │   ├── testMorphingArrayWithEightSpacesPrettyPrintIndent.jsonp.php
    │   │       │   ├── testMorphingArrayWithFourSpacesPrettyPrintIndent.jsonp.php
    │   │       │   ├── testMorphingArrayWithOneTabPrettyPrintIndent.jsonp.php
    │   │       │   └── testMorphingArrayWithTwoSpacesPrettyPrintIndent.jsonp.php
    │   │       ├── JsonTest.php
    │   │       └── JsonpTest.php
    │   ├── ResponseTest.php
    │   └── Validation/
    │       ├── AcceptTest.php
    │       ├── DomainTest.php
    │       └── PrefixTest.php
    ├── Routing/
    │   ├── Adapter/
    │   │   ├── BaseAdapterTest.php
    │   │   ├── LaravelTest.php
    │   │   └── LumenTest.php
    │   ├── RouteTest.php
    │   └── RouterTest.php
    ├── Stubs/
    │   ├── Application58Stub.php
    │   ├── Application6Stub.php
    │   ├── Application7Stub.php
    │   ├── Application8Stub.php
    │   ├── ApplicationStub.php
    │   ├── AuthorizationProviderStub.php
    │   ├── BasicThrottleStub.php
    │   ├── EloquentModelStub.php
    │   ├── HttpValidatorStub.php
    │   ├── MiddlewareStub.php
    │   ├── RoutingAdapterStub.php
    │   ├── RoutingControllerOtherStub.php
    │   ├── RoutingControllerStub.php
    │   ├── ThrottleStub.php
    │   ├── TransformerStub.php
    │   ├── UserStub.php
    │   └── UserTransformerStub.php
    └── Transformer/
        ├── Adapter/
        │   └── FractalTest.php
        └── FactoryTest.php
Download .txt
SYMBOL INDEX (1010 symbols across 120 files)

FILE: src/Auth/Auth.php
  class Auth (line 11) | class Auth
    method __construct (line 57) | public function __construct(Router $router, Container $container, arra...
    method authenticate (line 73) | public function authenticate(array $providers = [])
    method throwUnauthorizedException (line 108) | protected function throwUnauthorizedException(array $exceptionStack)
    method filterProviders (line 126) | protected function filterProviders(array $providers)
    method getUser (line 142) | public function getUser($authenticate = true)
    method user (line 164) | public function user($authenticate = true)
    method setUser (line 176) | public function setUser($user)
    method check (line 190) | public function check($authenticate = false)
    method getProviderUsed (line 200) | public function getProviderUsed()
    method extend (line 213) | public function extend($key, $provider)

FILE: src/Auth/Provider/Authorization.php
  class Authorization (line 9) | abstract class Authorization implements \Dingo\Api\Contract\Auth\Provider
    method validateAuthorizationHeader (line 27) | public function validateAuthorizationHeader(Request $request)
    method getAuthorizationMethod (line 41) | abstract public function getAuthorizationMethod();

FILE: src/Auth/Provider/Basic.php
  class Basic (line 10) | class Basic extends Authorization
    method __construct (line 34) | public function __construct(AuthManager $auth, $identifier = 'email')
    method authenticate (line 48) | public function authenticate(Request $request, Route $route)
    method getAuthorizationMethod (line 64) | public function getAuthorizationMethod()

FILE: src/Auth/Provider/JWT.php
  class JWT (line 12) | class JWT extends Authorization
    method __construct (line 28) | public function __construct(JWTAuth $auth)
    method authenticate (line 41) | public function authenticate(Request $request, Route $route)
    method getToken (line 65) | protected function getToken(Request $request)
    method parseAuthorizationHeader (line 87) | protected function parseAuthorizationHeader(Request $request)
    method getAuthorizationMethod (line 97) | public function getAuthorizationMethod()

FILE: src/Console/Command/Cache.php
  class Cache (line 11) | class Cache extends Command
    method __construct (line 57) | public function __construct(Filesystem $files, Router $router, Adapter...
    method handle (line 71) | public function handle()
    method getFreshApplication (line 105) | protected function getFreshApplication()

FILE: src/Console/Command/Docs.php
  class Docs (line 14) | class Docs extends Command
    method __construct (line 87) | public function __construct(Router $router, Blueprint $blueprint, Writ...
    method handle (line 103) | public function handle()
    method getDocName (line 121) | protected function getDocName()
    method getIncludePath (line 139) | protected function getIncludePath()
    method getVersion (line 149) | protected function getVersion()
    method getControllers (line 167) | protected function getControllers()
    method addControllerIfNotExists (line 198) | protected function addControllerIfNotExists(Collection $controllers, $...

FILE: src/Console/Command/Routes.php
  class Routes (line 12) | class Routes extends RouteListCommand
    method __construct (line 56) | public function __construct(Router $router)
    method fire (line 70) | public function fire()
    method handle (line 82) | public function handle()
    method getRoutes (line 94) | protected function getRoutes()
    method routeRateLimit (line 145) | protected function routeRateLimit($route)
    method filterRoute (line 161) | protected function filterRoute(array $route)
    method getOptions (line 179) | protected function getOptions()
    method filterByPath (line 209) | protected function filterByPath(array $route)
    method filterByProtected (line 221) | protected function filterByProtected(array $route)
    method filterByUnprotected (line 233) | protected function filterByUnprotected(array $route)
    method filterByVersions (line 245) | protected function filterByVersions(array $route)
    method filterByName (line 263) | protected function filterByName(array $route)
    method filterByScopes (line 275) | protected function filterByScopes(array $route)

FILE: src/Contract/Auth/Provider.php
  type Provider (line 8) | interface Provider
    method authenticate (line 18) | public function authenticate(Request $request, Route $route);

FILE: src/Contract/Debug/ExceptionHandler.php
  type ExceptionHandler (line 5) | interface ExceptionHandler
    method handle (line 14) | public function handle($exception);

FILE: src/Contract/Debug/MessageBagErrors.php
  type MessageBagErrors (line 5) | interface MessageBagErrors
    method getErrors (line 12) | public function getErrors();
    method hasErrors (line 19) | public function hasErrors();

FILE: src/Contract/Http/Parser.php
  type Parser (line 7) | interface Parser
    method parse (line 16) | public function parse(IlluminateRequest $request);

FILE: src/Contract/Http/RateLimit/HasRateLimiter.php
  type HasRateLimiter (line 8) | interface HasRateLimiter
    method getRateLimiter (line 18) | public function getRateLimiter(Container $app, Request $request);

FILE: src/Contract/Http/RateLimit/Throttle.php
  type Throttle (line 7) | interface Throttle
    method match (line 16) | public function match(Container $container);
    method getExpires (line 23) | public function getExpires();
    method getLimit (line 30) | public function getLimit();

FILE: src/Contract/Http/Request.php
  type Request (line 7) | interface Request
    method createFromIlluminate (line 16) | public function createFromIlluminate(IlluminateRequest $old);

FILE: src/Contract/Http/Validator.php
  type Validator (line 7) | interface Validator
    method validate (line 16) | public function validate(IlluminateRequest $request);

FILE: src/Contract/Routing/Adapter.php
  type Adapter (line 7) | interface Adapter
    method dispatch (line 17) | public function dispatch(Request $request, $version);
    method getRouteProperties (line 27) | public function getRouteProperties($route, Request $request);
    method addRoute (line 39) | public function addRoute(array $methods, array $versions, $uri, $action);
    method getRoutes (line 48) | public function getRoutes($version = null);
    method getIterableRoutes (line 58) | public function getIterableRoutes($version = null);
    method setRoutes (line 67) | public function setRoutes(array $routes);
    method prepareRouteForSerialization (line 76) | public function prepareRouteForSerialization($route);

FILE: src/Contract/Transformer/Adapter.php
  type Adapter (line 8) | interface Adapter
    method transform (line 20) | public function transform($response, $transformer, Binding $binding, R...

FILE: src/Dispatcher.php
  class Dispatcher (line 17) | class Dispatcher
    method __construct (line 176) | public function __construct(Container $container, Filesystem $files, R...
    method setupRequestStack (line 191) | protected function setupRequestStack()
    method attach (line 203) | public function attach(array $files)
    method be (line 229) | public function be($user)
    method json (line 243) | public function json($content)
    method on (line 261) | public function on($domain)
    method raw (line 273) | public function raw()
    method once (line 285) | public function once()
    method version (line 299) | public function version($version)
    method with (line 313) | public function with($parameters)
    method header (line 328) | public function header($key, $value)
    method cookie (line 342) | public function cookie(Cookie $cookie)
    method get (line 357) | public function get($uri, $parameters = [])
    method post (line 371) | public function post($uri, $parameters = [], $content = '')
    method put (line 385) | public function put($uri, $parameters = [], $content = '')
    method patch (line 399) | public function patch($uri, $parameters = [], $content = '')
    method delete (line 413) | public function delete($uri, $parameters = [], $content = '')
    method queueRequest (line 428) | protected function queueRequest($verb, $uri, $parameters, $content = '')
    method createRequest (line 458) | protected function createRequest($verb, $uri, $parameters)
    method addPrefixToUri (line 499) | protected function addPrefixToUri($uri)
    method getAcceptHeader (line 519) | protected function getAcceptHeader()
    method dispatch (line 533) | protected function dispatch(InternalRequest $request)
    method refreshRequestStack (line 571) | protected function refreshRequestStack()
    method replaceRequestInstance (line 599) | protected function replaceRequestInstance()
    method clearCachedFacadeInstance (line 611) | protected function clearCachedFacadeInstance()
    method getRootRequest (line 624) | protected function getRootRequest()
    method getDomain (line 634) | public function getDomain()
    method getVersion (line 644) | public function getVersion()
    method getFormat (line 654) | public function getFormat()
    method getSubtype (line 664) | public function getSubtype()
    method setSubtype (line 676) | public function setSubtype($subtype)
    method getStandardsTree (line 686) | public function getStandardsTree()
    method setStandardsTree (line 698) | public function setStandardsTree($standardsTree)
    method setPrefix (line 710) | public function setPrefix($prefix)
    method setDefaultVersion (line 722) | public function setDefaultVersion($version)
    method setDefaultDomain (line 734) | public function setDefaultDomain($domain)
    method setDefaultFormat (line 746) | public function setDefaultFormat($format)

FILE: src/Event/RequestWasMatched.php
  class RequestWasMatched (line 8) | class RequestWasMatched
    method __construct (line 32) | public function __construct(Request $request, Container $app)

FILE: src/Event/ResponseIsMorphing.php
  class ResponseIsMorphing (line 7) | class ResponseIsMorphing
    method __construct (line 32) | public function __construct(Response $response, &$content)

FILE: src/Event/ResponseWasMorphed.php
  class ResponseWasMorphed (line 5) | class ResponseWasMorphed extends ResponseIsMorphing

FILE: src/Exception/DeleteResourceFailedException.php
  class DeleteResourceFailedException (line 5) | class DeleteResourceFailedException extends ResourceException

FILE: src/Exception/Handler.php
  class Handler (line 21) | class Handler implements ExceptionHandler, IlluminateExceptionHandler
    method __construct (line 67) | public function __construct(IlluminateExceptionHandler $parentHandler,...
    method report (line 81) | public function report(Throwable $throwable)
    method shouldReport (line 93) | public function shouldReport(Throwable $e)
    method render (line 108) | public function render($request, Throwable $exception)
    method renderForConsole (line 121) | public function renderForConsole($output, Throwable $exception)
    method register (line 133) | public function register(callable $callback)
    method handle (line 147) | public function handle($exception)
    method genericResponse (line 180) | protected function genericResponse(Throwable $exception)
    method getStatusCode (line 204) | protected function getStatusCode(Throwable $exception)
    method getHeaders (line 232) | protected function getHeaders(Throwable $exception)
    method prepareReplacements (line 244) | protected function prepareReplacements(Throwable $exception)
    method setReplacements (line 299) | public function setReplacements(array $replacements)
    method recursivelyRemoveEmptyReplacements (line 311) | protected function recursivelyRemoveEmptyReplacements(array $input)
    method newResponseArray (line 333) | protected function newResponseArray()
    method getExceptionStatusCode (line 346) | protected function getExceptionStatusCode(Exception $exception, $defau...
    method runningInDebugMode (line 356) | protected function runningInDebugMode()
    method handlerHint (line 368) | protected function handlerHint(callable $callback)
    method getHandlers (line 389) | public function getHandlers()
    method setErrorFormat (line 401) | public function setErrorFormat(array $format)
    method setDebug (line 413) | public function setDebug($debug)

FILE: src/Exception/InternalHttpException.php
  class InternalHttpException (line 9) | class InternalHttpException extends HttpException
    method __construct (line 29) | public function __construct(Response $response, $message = null, Excep...
    method getResponse (line 41) | public function getResponse()

FILE: src/Exception/RateLimitExceededException.php
  class RateLimitExceededException (line 8) | class RateLimitExceededException extends HttpException
    method __construct (line 20) | public function __construct($message = null, Exception $previous = nul...

FILE: src/Exception/ResourceException.php
  class ResourceException (line 10) | class ResourceException extends HttpException implements MessageBagErrors
    method __construct (line 30) | public function __construct($message = null, $errors = null, Exception...
    method getErrors (line 46) | public function getErrors()
    method hasErrors (line 56) | public function hasErrors()

FILE: src/Exception/StoreResourceFailedException.php
  class StoreResourceFailedException (line 5) | class StoreResourceFailedException extends ResourceException

FILE: src/Exception/UnknownVersionException.php
  class UnknownVersionException (line 8) | class UnknownVersionException extends HttpException
    method __construct (line 19) | public function __construct($message = null, Exception $previous = nul...

FILE: src/Exception/UpdateResourceFailedException.php
  class UpdateResourceFailedException (line 5) | class UpdateResourceFailedException extends ResourceException

FILE: src/Exception/ValidationHttpException.php
  class ValidationHttpException (line 7) | class ValidationHttpException extends ResourceException
    method __construct (line 19) | public function __construct($errors = null, Exception $previous = null...

FILE: src/Facade/API.php
  class API (line 8) | class API extends Facade
    method getFacadeAccessor (line 15) | protected static function getFacadeAccessor()
    method error (line 27) | public static function error(callable $callback)
    method transform (line 40) | public static function transform($class, $transformer)
    method auth (line 50) | public static function auth()
    method user (line 60) | public static function user()
    method internal (line 70) | public static function internal()
    method response (line 80) | public static function response()
    method router (line 90) | public static function router()
    method route (line 103) | public static function route($routeName, $apiVersion = 'v1')

FILE: src/Facade/Route.php
  class Route (line 7) | class Route extends Facade
    method getFacadeAccessor (line 14) | protected static function getFacadeAccessor()

FILE: src/Http/FormRequest.php
  class FormRequest (line 16) | class FormRequest extends Request implements ValidatesWhenResolved
    method validate (line 75) | public function validate()
    method getValidatorInstance (line 95) | protected function getValidatorInstance()
    method createDefaultValidator (line 119) | protected function createDefaultValidator(ValidationFactory $factory)
    method validationData (line 134) | protected function validationData()
    method failedValidation (line 146) | protected function failedValidation(Validator $validator)
    method response (line 162) | public function response(array $errors)
    method formatErrors (line 180) | protected function formatErrors(Validator $validator)
    method getRedirectUrl (line 190) | protected function getRedirectUrl()
    method passesAuthorization (line 210) | protected function passesAuthorization()
    method failedAuthorization (line 224) | protected function failedAuthorization()
    method messages (line 238) | public function messages()
    method attributes (line 248) | public function attributes()
    method setRedirector (line 260) | public function setRedirector($redirector)
    method setContainer (line 274) | public function setContainer(Container $container)

FILE: src/Http/InternalRequest.php
  class InternalRequest (line 5) | class InternalRequest extends Request
    method __construct (line 7) | public function __construct(array $query = [], array $request = [], ar...

FILE: src/Http/Middleware/Auth.php
  class Auth (line 9) | class Auth
    method __construct (line 33) | public function __construct(Router $router, Authentication $auth)
    method handle (line 47) | public function handle($request, Closure $next)

FILE: src/Http/Middleware/PrepareController.php
  class PrepareController (line 8) | class PrepareController
    method __construct (line 24) | public function __construct(Router $router)
    method handle (line 37) | public function handle($request, Closure $next)

FILE: src/Http/Middleware/RateLimit.php
  class RateLimit (line 12) | class RateLimit
    method __construct (line 36) | public function __construct(Router $router, Handler $handler)
    method handle (line 52) | public function handle($request, Closure $next)
    method responseWithHeaders (line 86) | protected function responseWithHeaders($response)
    method getHeaders (line 100) | protected function getHeaders()

FILE: src/Http/Middleware/Request.php
  class Request (line 19) | class Request
    method __construct (line 74) | public function __construct(Container $app, ExceptionHandler $exceptio...
    method handle (line 91) | public function handle($request, Closure $next)
    method sendRequestThroughRouter (line 121) | protected function sendRequestThroughRouter(HttpRequest $request)
    method terminate (line 135) | public function terminate($request, $response)
    method parseMiddleware (line 179) | protected function parseMiddleware($middleware)
    method gatherRouteMiddlewares (line 197) | protected function gatherRouteMiddlewares($request)
    method setMiddlewares (line 213) | public function setMiddlewares(array $middleware)
    method mergeMiddlewares (line 225) | public function mergeMiddlewares(array $middleware)

FILE: src/Http/Parser/Accept.php
  class Accept (line 9) | class Accept implements Parser
    method __construct (line 49) | public function __construct($standardsTree, $subtype, $version, $format)
    method parse (line 68) | public function parse(Request $request, $strict = false)

FILE: src/Http/RateLimit/Handler.php
  class Handler (line 14) | class Handler
    method __construct (line 74) | public function __construct(Container $container, CacheManager $cache,...
    method rateLimitRequest (line 90) | public function rateLimitRequest(Request $request, $limit = 0, $expire...
    method prepareCacheStore (line 135) | protected function prepareCacheStore()
    method exceededRateLimit (line 149) | public function exceededRateLimit()
    method getMatchingThrottles (line 159) | protected function getMatchingThrottles()
    method key (line 173) | protected function key($key)
    method cache (line 187) | protected function cache($key, $value, $minutes)
    method retrieve (line 199) | protected function retrieve($key)
    method increment (line 211) | protected function increment($key)
    method forget (line 223) | protected function forget($key)
    method requestWasRateLimited (line 233) | public function requestWasRateLimited()
    method getRateLimiter (line 243) | public function getRateLimiter()
    method setRateLimiter (line 257) | public function setRateLimiter(callable $limiter)
    method setThrottle (line 269) | public function setThrottle($throttle)
    method getThrottle (line 283) | public function getThrottle()
    method getThrottleLimit (line 293) | public function getThrottleLimit()
    method getRemainingLimit (line 303) | public function getRemainingLimit()
    method getRateLimitReset (line 315) | public function getRateLimitReset()
    method extend (line 327) | public function extend($throttle)

FILE: src/Http/RateLimit/Throttle/Authenticated.php
  class Authenticated (line 7) | class Authenticated extends Throttle
    method match (line 16) | public function match(Container $container)

FILE: src/Http/RateLimit/Throttle/Route.php
  class Route (line 7) | class Route extends Throttle
    method match (line 16) | public function match(Container $container)

FILE: src/Http/RateLimit/Throttle/Throttle.php
  class Throttle (line 7) | abstract class Throttle implements RateLimitThrottle
    method __construct (line 23) | public function __construct(array $options = [])
    method getLimit (line 33) | public function getLimit()
    method getExpires (line 43) | public function getExpires()

FILE: src/Http/RateLimit/Throttle/Unauthenticated.php
  class Unauthenticated (line 7) | class Unauthenticated extends Throttle
    method match (line 16) | public function match(Container $container)

FILE: src/Http/Request.php
  class Request (line 9) | class Request extends IlluminateRequest implements RequestInterface
    method createFromIlluminate (line 32) | public function createFromIlluminate(IlluminateRequest $old)
    method version (line 54) | public function version()
    method subtype (line 66) | public function subtype()
    method format (line 78) | public function format($default = 'html')
    method parseAcceptHeader (line 90) | protected function parseAcceptHeader()
    method setAcceptParser (line 106) | public static function setAcceptParser(Accept $acceptParser)
    method getAcceptParser (line 116) | public static function getAcceptParser()

FILE: src/Http/RequestValidator.php
  class RequestValidator (line 12) | class RequestValidator
    method __construct (line 38) | public function __construct(Container $container)
    method replace (line 50) | public function replace(array $validators)
    method merge (line 62) | public function merge(array $validators)
    method extend (line 74) | public function extend($validator)
    method validateRequest (line 86) | public function validateRequest(IlluminateRequest $request)

FILE: src/Http/Response.php
  class Response (line 20) | class Response extends IlluminateResponse
    method __construct (line 74) | public function __construct($content, $status = 200, $headers = [], Bi...
    method makeFromExisting (line 88) | public static function makeFromExisting(IlluminateResponse $old)
    method makeFromJson (line 104) | public static function makeFromJson(JsonResponse $json)
    method morph (line 129) | public function morph($format = 'json')
    method fireMorphedEvent (line 173) | protected function fireMorphedEvent()
    method fireMorphingEvent (line 187) | protected function fireMorphingEvent()
    method setContent (line 199) | public function setContent($content)
    method setEventDispatcher (line 227) | public static function setEventDispatcher(EventDispatcher $events)
    method getFormatter (line 241) | public static function getFormatter($format)
    method hasFormatter (line 257) | public static function hasFormatter($format)
    method setFormatters (line 269) | public static function setFormatters(array $formatters)
    method setFormatsOptions (line 281) | public static function setFormatsOptions(array $formatsOptions)
    method getFormatsOptions (line 293) | public static function getFormatsOptions($format)
    method hasOptionsForFormat (line 309) | public static function hasOptionsForFormat($format)
    method addFormatter (line 322) | public static function addFormatter($key, $formatter)
    method setTransformer (line 334) | public static function setTransformer(TransformerFactory $transformer)
    method getTransformer (line 344) | public static function getTransformer()
    method addMeta (line 357) | public function addMeta($key, $value)
    method meta (line 372) | public function meta($key, $value)
    method setMeta (line 384) | public function setMeta(array $meta)
    method getMeta (line 396) | public function getMeta()
    method cookie (line 408) | public function cookie($cookie)
    method withHeader (line 422) | public function withHeader($key, $value, $replace = true)
    method statusCode (line 434) | public function statusCode($statusCode)

FILE: src/Http/Response/Factory.php
  class Factory (line 14) | class Factory
    method __construct (line 30) | public function __construct(TransformerFactory $transformer)
    method created (line 42) | public function created($location = null, $content = null)
    method accepted (line 62) | public function accepted($location = null, $content = null)
    method noContent (line 79) | public function noContent()
    method collection (line 96) | public function collection(Collection $collection, $transformer = null...
    method item (line 128) | public function item($item, $transformer = null, $parameters = [], Clo...
    method array (line 161) | public function array(array $array, $transformer = null, $parameters =...
    method paginator (line 193) | public function paginator(Paginator $paginator, $transformer = null, a...
    method error (line 220) | public function error($message, $statusCode)
    method errorNotFound (line 234) | public function errorNotFound($message = 'Not Found')
    method errorBadRequest (line 248) | public function errorBadRequest($message = 'Bad Request')
    method errorForbidden (line 262) | public function errorForbidden($message = 'Forbidden')
    method errorInternal (line 276) | public function errorInternal($message = 'Internal Error')
    method errorUnauthorized (line 290) | public function errorUnauthorized($message = 'Unauthorized')
    method errorMethodNotAllowed (line 304) | public function errorMethodNotAllowed($message = 'Method Not Allowed')
    method __call (line 319) | public function __call($method, $parameters)

FILE: src/Http/Response/Format/Format.php
  class Format (line 5) | abstract class Format
    method setRequest (line 35) | public function setRequest($request)
    method setResponse (line 49) | public function setResponse($response)
    method setOptions (line 63) | public function setOptions(array $options)
    method formatEloquentModel (line 77) | abstract public function formatEloquentModel($model);
    method formatEloquentCollection (line 86) | abstract public function formatEloquentCollection($collection);
    method formatArray (line 95) | abstract public function formatArray($content);
    method getContentType (line 102) | abstract public function getContentType();

FILE: src/Http/Response/Format/Json.php
  class Json (line 8) | class Json extends Format
    method formatEloquentModel (line 24) | public function formatEloquentModel($model)
    method formatEloquentCollection (line 42) | public function formatEloquentCollection($collection)
    method formatArray (line 65) | public function formatArray($content)
    method getContentType (line 81) | public function getContentType()
    method morphToArray (line 93) | protected function morphToArray($value)
    method encode (line 105) | protected function encode($content)

FILE: src/Http/Response/Format/JsonOptionalFormatting.php
  type JsonOptionalFormatting (line 5) | trait JsonOptionalFormatting
    method isJsonPrettyPrintEnabled (line 54) | protected function isJsonPrettyPrintEnabled()
    method isCustomIndentStyleRequired (line 64) | protected function isCustomIndentStyleRequired()
    method performJsonEncoding (line 79) | protected function performJsonEncoding($content, array $jsonEncodeOpti...
    method filterJsonEncodeOptions (line 99) | protected function filterJsonEncodeOptions(array $jsonEncodeOptions)
    method calucateJsonEncodeOptionsBitmask (line 111) | protected function calucateJsonEncodeOptionsBitmask(array $jsonEncodeO...
    method indentPrettyPrintedJson (line 125) | protected function indentPrettyPrintedJson($jsonString, $indentStyle, ...
    method getIndentCharForIndentStyle (line 150) | protected function getIndentCharForIndentStyle($indentStyle)
    method getPrettyPrintIndentSize (line 160) | protected function getPrettyPrintIndentSize()
    method hasVariousIndentSize (line 174) | protected function hasVariousIndentSize($indentStyle)
    method peformIndentation (line 190) | protected function peformIndentation($jsonString, $indentChar = "\t", ...

FILE: src/Http/Response/Format/Jsonp.php
  class Jsonp (line 5) | class Jsonp extends Json
    method __construct (line 21) | public function __construct($callbackName = 'callback')
    method hasValidCallback (line 31) | protected function hasValidCallback()
    method getCallback (line 41) | protected function getCallback()
    method getContentType (line 51) | public function getContentType()
    method encode (line 67) | protected function encode($content)

FILE: src/Http/Validation/Accept.php
  class Accept (line 10) | class Accept implements Validator
    method __construct (line 34) | public function __construct(AcceptParser $accept, $strict = false)
    method validate (line 52) | public function validate(Request $request)

FILE: src/Http/Validation/Domain.php
  class Domain (line 9) | class Domain implements Validator
    method __construct (line 27) | public function __construct($domain)
    method validate (line 39) | public function validate(Request $request)
    method stripProtocol (line 51) | protected function stripProtocol($domain)
    method stripPort (line 67) | protected function stripPort($domain)
    method getStrippedDomain (line 81) | protected function getStrippedDomain()

FILE: src/Http/Validation/Prefix.php
  class Prefix (line 8) | class Prefix implements Validator
    method __construct (line 24) | public function __construct($prefix)
    method validate (line 37) | public function validate(Request $request)
    method filterAndExplode (line 53) | protected function filterAndExplode($array)

FILE: src/Provider/DingoServiceProvider.php
  class DingoServiceProvider (line 14) | class DingoServiceProvider extends ServiceProvider
    method boot (line 21) | public function boot()
    method setResponseStaticInstances (line 32) | protected function setResponseStaticInstances()
    method register (line 45) | public function register()
    method registerConfig (line 78) | protected function registerConfig()
    method registerClassAliases (line 92) | protected function registerClassAliases()
    method registerExceptionHandler (line 120) | protected function registerExceptionHandler()
    method registerDispatcher (line 132) | public function registerDispatcher()
    method registerAuth (line 153) | protected function registerAuth()
    method registerTransformer (line 165) | protected function registerTransformer()
    method registerDocsCommand (line 177) | protected function registerDocsCommand()

FILE: src/Provider/HttpServiceProvider.php
  class HttpServiceProvider (line 24) | class HttpServiceProvider extends ServiceProvider
    method register (line 31) | public function register()
    method registerRateLimiting (line 49) | protected function registerRateLimiting()
    method registerHttpValidation (line 61) | protected function registerHttpValidation()
    method registerHttpParsers (line 88) | protected function registerHttpParsers()
    method registerResponseFactory (line 105) | protected function registerResponseFactory()
    method registerMiddleware (line 117) | protected function registerMiddleware()

FILE: src/Provider/LaravelServiceProvider.php
  class LaravelServiceProvider (line 20) | class LaravelServiceProvider extends DingoServiceProvider
    method boot (line 27) | public function boot()
    method replaceRouteDispatcher (line 72) | protected function replaceRouteDispatcher()
    method updateRouterBindings (line 85) | protected function updateRouterBindings()
    method getRouterBindings (line 97) | protected function getRouterBindings()
    method register (line 110) | public function register()
    method registerRouterAdapter (line 122) | protected function registerRouterAdapter()
    method addRequestMiddlewareToBeginning (line 136) | protected function addRequestMiddlewareToBeginning(Kernel $kernel)
    method addMiddlewareAlias (line 151) | protected function addMiddlewareAlias($name, $class)
    method gatherAppMiddleware (line 170) | protected function gatherAppMiddleware(Kernel $kernel)
    method initializeRequest (line 186) | protected function initializeRequest(FormRequest $form, IlluminateRequ...

FILE: src/Provider/LumenServiceProvider.php
  class LumenServiceProvider (line 20) | class LumenServiceProvider extends DingoServiceProvider
    method boot (line 29) | public function boot()
    method setupConfig (line 80) | protected function setupConfig()
    method register (line 92) | public function register()
    method getDispatcherResolver (line 106) | protected function getDispatcherResolver()
    method addRequestMiddlewareToBeginning (line 121) | protected function addRequestMiddlewareToBeginning(ReflectionClass $re...
    method gatherAppMiddleware (line 142) | protected function gatherAppMiddleware(ReflectionClass $reflection)
    method initializeRequest (line 160) | protected function initializeRequest(FormRequest $form, IlluminateRequ...

FILE: src/Provider/RoutingServiceProvider.php
  class RoutingServiceProvider (line 11) | class RoutingServiceProvider extends ServiceProvider
    method register (line 16) | public function register()
    method registerRouter (line 26) | protected function registerRouter()
    method registerUrlGenerator (line 50) | protected function registerUrlGenerator()
    method requestRebinder (line 70) | private function requestRebinder()

FILE: src/Provider/ServiceProvider.php
  class ServiceProvider (line 7) | abstract class ServiceProvider extends IlluminateServiceProvider
    method config (line 26) | protected function config($item, $instantiate = true)
    method instantiateConfigValues (line 45) | protected function instantiateConfigValues($item, array $values)
    method instantiateConfigValue (line 62) | protected function instantiateConfigValue($item, $value)

FILE: src/Routing/Adapter/Laravel.php
  class Laravel (line 12) | class Laravel implements Adapter
    method __construct (line 63) | public function __construct(Router $router)
    method dispatch (line 76) | public function dispatch(Request $request, $version)
    method mergeOldRoutes (line 102) | protected function mergeOldRoutes($version)
    method getRouteProperties (line 130) | public function getRouteProperties($route, Request $request)
    method addRoute (line 149) | public function addRoute(array $methods, array $versions, $uri, $action)
    method createRouteCollections (line 173) | protected function createRouteCollections(array $versions)
    method getRoutes (line 189) | public function getRoutes($version = null)
    method getIterableRoutes (line 205) | public function getIterableRoutes($version = null)
    method setRoutes (line 217) | public function setRoutes(array $routes)
    method prepareRouteForSerialization (line 229) | public function prepareRouteForSerialization($route)
    method gatherRouteMiddlewares (line 243) | public function gatherRouteMiddlewares($route)
    method getRouter (line 257) | public function getRouter()
    method getPatterns (line 267) | public function getPatterns()

FILE: src/Routing/Adapter/Lumen.php
  class Lumen (line 17) | class Lumen implements Adapter
    method __construct (line 85) | public function __construct(Application $app, RouteParser $parser, Dat...
    method dispatch (line 101) | public function dispatch(Request $request, $version)
    method mergeOldRoutes (line 126) | protected function mergeOldRoutes($version)
    method normalizeRequestUri (line 148) | protected function normalizeRequestUri(Request $request)
    method getRouteProperties (line 165) | public function getRouteProperties($route, Request $request)
    method addRoute (line 188) | public function addRoute(array $methods, array $versions, $uri, $action)
    method breakUriSegments (line 206) | protected function breakUriSegments($uri)
    method createRouteCollections (line 237) | protected function createRouteCollections(array $versions)
    method removeMiddlewareFromApp (line 253) | protected function removeMiddlewareFromApp()
    method getRoutes (line 282) | public function getRoutes($version = null)
    method getIterableRoutes (line 298) | public function getIterableRoutes($version = null)
    method normalizeStaticRoutes (line 344) | protected function normalizeStaticRoutes(array $routes)
    method stringIsHttpMethod (line 375) | protected function stringIsHttpMethod($string)
    method setRoutes (line 389) | public function setRoutes(array $routes)
    method prepareRouteForSerialization (line 401) | public function prepareRouteForSerialization($route)
    method gatherRouteMiddlewares (line 413) | public function gatherRouteMiddlewares($route)
    method setRouteMethods (line 427) | private function setRouteMethods($route, $method)

FILE: src/Routing/Helpers.php
  type Helpers (line 16) | trait Helpers
    method throttle (line 54) | protected function throttle($class, array $options = [])
    method rateLimit (line 68) | protected function rateLimit($limit, $expires, array $options = [])
    method scopes (line 81) | protected function scopes($scopes, array $options = [])
    method authenticateWith (line 96) | protected function authenticateWith($providers, array $options = [])
    method getPropertyValue (line 110) | protected function getPropertyValue($value)
    method getThrottles (line 120) | public function getThrottles()
    method getRateLimit (line 130) | public function getRateLimit()
    method getScopes (line 140) | public function getScopes()
    method getAuthenticationProviders (line 150) | public function getAuthenticationProviders()
    method api (line 160) | public function api()
    method user (line 170) | protected function user()
    method auth (line 180) | protected function auth()
    method response (line 190) | protected function response()
    method __get (line 204) | public function __get($key)
    method __call (line 227) | public function __call($method, $parameters)

FILE: src/Routing/ResourceRegistrar.php
  class ResourceRegistrar (line 8) | class ResourceRegistrar extends IlluminateResourceRegistrar
    method __construct (line 24) | public function __construct(Router $router)
    method register (line 38) | public function register($name, $controller, array $options = [])

FILE: src/Routing/Route.php
  class Route (line 11) | class Route extends \Illuminate\Routing\Route
    method __construct (line 92) | public function __construct(Adapter $adapter, Container $container, Re...
    method setupRouteProperties (line 111) | protected function setupRouteProperties(Request $request, $route)
    method mergeControllerProperties (line 138) | protected function mergeControllerProperties()
    method findControllerPropertyOptions (line 188) | protected function findControllerPropertyOptions($name)
    method optionsApplyToControllerMethod (line 212) | protected function optionsApplyToControllerMethod(array $options)
    method explodeOnPipes (line 235) | protected function explodeOnPipes($value)
    method controllerUsesHelpersTrait (line 245) | protected function controllerUsesHelpersTrait()
    method getControllerInstance (line 269) | public function getControllerInstance()
    method makeControllerInstance (line 279) | protected function makeControllerInstance()
    method isProtected (line 294) | public function isProtected()
    method hasThrottle (line 312) | public function hasThrottle()
    method throttle (line 322) | public function throttle()
    method getThrottle (line 332) | public function getThrottle()
    method scopes (line 342) | public function scopes()
    method getScopes (line 352) | public function getScopes()
    method scopeStrict (line 362) | public function scopeStrict()
    method authenticationProviders (line 372) | public function authenticationProviders()
    method getAuthenticationProviders (line 382) | public function getAuthenticationProviders()
    method rateLimit (line 392) | public function rateLimit()
    method getRateLimit (line 402) | public function getRateLimit()
    method rateLimitExpiration (line 412) | public function rateLimitExpiration()
    method getRateLimitExpiration (line 422) | public function getRateLimitExpiration()
    method getName (line 432) | public function getName()
    method requestIsConditional (line 442) | public function requestIsConditional()
    method getVersions (line 452) | public function getVersions()
    method versions (line 462) | public function versions()
    method getPath (line 472) | public function getPath()
    method uri (line 482) | public function uri()
    method getMethods (line 492) | public function getMethods()
    method methods (line 502) | public function methods()
    method httpOnly (line 512) | public function httpOnly()
    method httpsOnly (line 523) | public function httpsOnly()
    method secure (line 533) | public function secure()
    method getMiddleware (line 544) | public function getMiddleware()

FILE: src/Routing/RouteCollection.php
  class RouteCollection (line 9) | class RouteCollection implements Countable, IteratorAggregate
    method add (line 39) | public function add(Route $route)
    method addLookups (line 55) | protected function addLookups(Route $route)
    method getByName (line 75) | public function getByName($name)
    method getByAction (line 87) | public function getByAction($action)
    method getRoutes (line 97) | public function getRoutes()
    method getIterator (line 107) | public function getIterator()
    method count (line 117) | public function count()

FILE: src/Routing/Router.php
  class Router (line 20) | class Router
    method __construct (line 103) | public function __construct(Adapter $adapter, ExceptionHandler $except...
    method version (line 126) | public function version($version, $second, $third = null)
    method group (line 147) | public function group(array $attributes, $callback)
    method get (line 184) | public function get($uri, $action)
    method post (line 197) | public function post($uri, $action)
    method put (line 210) | public function put($uri, $action)
    method patch (line 223) | public function patch($uri, $action)
    method delete (line 236) | public function delete($uri, $action)
    method options (line 249) | public function options($uri, $action)
    method any (line 262) | public function any($uri, $action)
    method match (line 278) | public function match($methods, $uri, $action)
    method resources (line 290) | public function resources(array $resources)
    method resource (line 312) | public function resource($name, $controller, array $options = [])
    method addRoute (line 332) | public function addRoute($methods, $uri, $action)
    method addControllerMiddlewareToRouteAction (line 370) | protected function addControllerMiddlewareToRouteAction(array $action)
    method mergeLastGroupAttributes (line 384) | protected function mergeLastGroupAttributes(array $attributes)
    method mergeGroup (line 401) | protected function mergeGroup(array $new, array $old)
    method formatArrayBasedOption (line 440) | protected function formatArrayBasedOption($option, array $new)
    method formatUses (line 455) | protected function formatUses(array $new, array $old)
    method formatNamespace (line 472) | protected function formatNamespace(array $new, array $old)
    method formatPrefix (line 491) | protected function formatPrefix($new, $old)
    method dispatch (line 509) | public function dispatch(Request $request)
    method prepareResponse (line 541) | protected function prepareResponse($response, Request $request, $format)
    method gatherRouteMiddlewares (line 581) | public function gatherRouteMiddlewares($route)
    method requestIsConditional (line 591) | protected function requestIsConditional()
    method setConditionalRequest (line 603) | public function setConditionalRequest($conditionalRequest)
    method getCurrentRequest (line 613) | public function getCurrentRequest()
    method getCurrentRoute (line 623) | public function getCurrentRoute()
    method current (line 639) | public function current()
    method createRoute (line 651) | public function createRoute($route)
    method setCurrentRoute (line 663) | public function setCurrentRoute(Route $route)
    method hasGroupStack (line 673) | public function hasGroupStack()
    method getLastGroupPrefix (line 683) | public function getLastGroupPrefix()
    method getRoutes (line 701) | public function getRoutes($version = null)
    method getAdapterRoutes (line 729) | public function getAdapterRoutes()
    method setAdapterRoutes (line 741) | public function setAdapterRoutes(array $routes)
    method getRoutesDispatched (line 753) | public function getRoutesDispatched()
    method hasDispatchedRoutes (line 763) | public function hasDispatchedRoutes()
    method currentRouteName (line 773) | public function currentRouteName()
    method is (line 785) | public function is()
    method currentRouteNamed (line 803) | public function currentRouteNamed($name)
    method currentRouteAction (line 813) | public function currentRouteAction()
    method uses (line 831) | public function uses()
    method currentRouteUses (line 849) | public function currentRouteUses($action)
    method flushMiddlewareGroups (line 859) | public function flushMiddlewareGroups()

FILE: src/Routing/UrlGenerator.php
  class UrlGenerator (line 8) | class UrlGenerator extends IlluminateUrlGenerator
    method __construct (line 24) | public function __construct(Request $request)
    method version (line 36) | public function version($version)
    method setRouteCollections (line 48) | public function setRouteCollections(array $collections)

FILE: src/Transformer/Adapter/Fractal.php
  class Fractal (line 17) | class Fractal implements Adapter
    method __construct (line 57) | public function __construct(FractalManager $fractal, $includeKey = 'in...
    method transform (line 75) | public function transform($response, $transformer, Binding $binding, R...
    method shouldEagerLoad (line 120) | protected function shouldEagerLoad($response)
    method createPaginatorAdapter (line 136) | protected function createPaginatorAdapter(IlluminatePaginator $paginator)
    method createResource (line 150) | protected function createResource($response, $transformer, array $para...
    method parseFractalIncludes (line 168) | public function parseFractalIncludes(Request $request)
    method getFractal (line 184) | public function getFractal()
    method mergeEagerLoads (line 197) | protected function mergeEagerLoads($transformer, $requestedIncludes)
    method disableEagerLoading (line 219) | public function disableEagerLoading()
    method enableEagerLoading (line 231) | public function enableEagerLoading()

FILE: src/Transformer/Binding.php
  class Binding (line 9) | class Binding
    method __construct (line 56) | public function __construct(Container $container, $resolver, array $pa...
    method resolveTransformer (line 71) | public function resolveTransformer()
    method fireCallback (line 91) | public function fireCallback($parameters = null)
    method getParameters (line 103) | public function getParameters()
    method setMeta (line 115) | public function setMeta(array $meta)
    method addMeta (line 128) | public function addMeta($key, $value)
    method getMeta (line 138) | public function getMeta()

FILE: src/Transformer/Factory.php
  class Factory (line 14) | class Factory
    method __construct (line 45) | public function __construct(Container $container, Adapter $adapter)
    method register (line 61) | public function register($class, $resolver, array $parameters = [], Cl...
    method transform (line 73) | public function transform($response)
    method transformableResponse (line 87) | public function transformableResponse($response)
    method transformableType (line 99) | public function transformableType($value)
    method getBinding (line 113) | public function getBinding($class)
    method createBinding (line 137) | protected function createBinding($resolver, array $parameters = [], Cl...
    method getBindingFromCollection (line 149) | protected function getBindingFromCollection($collection)
    method hasBinding (line 161) | protected function hasBinding($class)
    method isCollection (line 179) | protected function isCollection($instance)
    method getTransformerBindings (line 189) | public function getTransformerBindings()
    method setAdapter (line 201) | public function setAdapter($adapter)
    method getAdapter (line 215) | public function getAdapter()
    method getRequest (line 225) | public function getRequest()
    method __call (line 244) | public function __call($method, $parameters)

FILE: src/helpers.php
  function version (line 11) | function version($version)

FILE: tests/Auth/AuthTest.php
  class AuthTest (line 16) | class AuthTest extends BaseTestCase
    method setUp (line 31) | public function setUp(): void
    method testExceptionThrownWhenAuthorizationHeaderNotSet (line 40) | public function testExceptionThrownWhenAuthorizationHeaderNotSet()
    method testExceptionThrownWhenProviderFailsToAuthenticate (line 55) | public function testExceptionThrownWhenProviderFailsToAuthenticate()
    method testAuthenticationIsSuccessfulAndUserIsSet (line 70) | public function testAuthenticationIsSuccessfulAndUserIsSet()
    method testProvidersAreFilteredWhenSpecificProviderIsRequested (line 85) | public function testProvidersAreFilteredWhenSpecificProviderIsRequested()
    method testGettingUserWhenNotAuthenticatedAttemptsToAuthenticateAndReturnsNull (line 100) | public function testGettingUserWhenNotAuthenticatedAttemptsToAuthentic...
    method testGettingUserWhenAlreadyAuthenticatedReturnsUser (line 110) | public function testGettingUserWhenAlreadyAuthenticatedReturnsUser()

FILE: tests/Auth/Provider/AuthorizationTest.php
  class AuthorizationTest (line 12) | class AuthorizationTest extends BaseTestCase
    method testExceptionThrownWhenAuthorizationHeaderIsInvalid (line 14) | public function testExceptionThrownWhenAuthorizationHeaderIsInvalid()

FILE: tests/Auth/Provider/BasicTest.php
  class BasicTest (line 13) | class BasicTest extends BaseTestCase
    method setUp (line 18) | public function setUp(): void
    method testInvalidBasicCredentialsThrowsException (line 26) | public function testInvalidBasicCredentialsThrowsException()
    method testValidCredentialsReturnsUser (line 37) | public function testValidCredentialsReturnsUser()

FILE: tests/Auth/Provider/JWTTest.php
  class JWTTest (line 14) | class JWTTest extends BaseTestCase
    method setUp (line 19) | public function setUp(): void
    method testValidatingAuthorizationHeaderFailsAndThrowsException (line 27) | public function testValidatingAuthorizationHeaderFailsAndThrowsExcepti...
    method testAuthenticatingFailsAndThrowsException (line 35) | public function testAuthenticatingFailsAndThrowsException()
    method testAuthenticatingSucceedsAndReturnsUserObject (line 48) | public function testAuthenticatingSucceedsAndReturnsUserObject()
    method testAuthenticatingWithQueryStringSucceedsAndReturnsUserObject (line 59) | public function testAuthenticatingWithQueryStringSucceedsAndReturnsUse...

FILE: tests/BaseTestCase.php
  class BaseTestCase (line 9) | class BaseTestCase extends TestCase
    method tearDown (line 11) | public function tearDown(): void
    method setUp (line 21) | public function setUp(): void

FILE: tests/ChecksLaravelVersionTrait.php
  type ChecksLaravelVersionTrait (line 11) | trait ChecksLaravelVersionTrait
    method getFrameworkVersion (line 16) | private function getFrameworkVersion()
    method getApplicationStub (line 46) | private function getApplicationStub()

FILE: tests/DispatcherTest.php
  class DispatcherTest (line 28) | class DispatcherTest extends BaseTestCase
    method setUp (line 59) | public function setUp(): void
    method testInternalRequests (line 88) | public function testInternalRequests()
    method testInternalRequestWithVersionAndParameters (line 119) | public function testInternalRequestWithVersionAndParameters()
    method testInternalRequestWithPrefix (line 130) | public function testInternalRequestWithPrefix()
    method testInternalRequestWithDomain (line 145) | public function testInternalRequestWithDomain()
    method testInternalRequestThrowsExceptionWhenResponseIsNotOkay (line 160) | public function testInternalRequestThrowsExceptionWhenResponseIsNotOkay()
    method testInternalExceptionContainsResponseObject (line 173) | public function testInternalExceptionContainsResponseObject()
    method testThrowingHttpExceptionFallsThroughRouter (line 189) | public function testThrowingHttpExceptionFallsThroughRouter()
    method testPretendingToBeUserForSingleRequest (line 208) | public function testPretendingToBeUserForSingleRequest()
    method testInternalRequestWithMultipleVersionsCallsCorrectVersion (line 221) | public function testInternalRequestWithMultipleVersionsCallsCorrectVer...
    method testInternalRequestWithNestedInternalRequest (line 240) | public function testInternalRequestWithNestedInternalRequest()
    method testRequestStackIsMaintained (line 263) | public function testRequestStackIsMaintained()
    method testRouteStackIsMaintained (line 286) | public function testRouteStackIsMaintained()
    method testSendingJsonPayload (line 309) | public function testSendingJsonPayload()
    method testInternalRequestsToDifferentDomains (line 325) | public function testInternalRequestsToDifferentDomains()
    method testRequestingRawResponse (line 350) | public function testRequestingRawResponse()
    method testRequestingRawResponseWithTransformers (line 365) | public function testRequestingRawResponseWithTransformers()
    method testUsingRequestFacadeDoesNotCacheRequestInstance (line 384) | public function testUsingRequestFacadeDoesNotCacheRequestInstance()
    method testRedirectResponseThrowsException (line 402) | public function testRedirectResponseThrowsException()
    method testNotOkJsonResponseThrowsException (line 415) | public function testNotOkJsonResponseThrowsException()
    method testFormRequestValidationFailureThrowsValidationException (line 428) | public function testFormRequestValidationFailureThrowsValidationExcept...

FILE: tests/Exception/HandlerTest.php
  class HandlerTest (line 16) | class HandlerTest extends BaseTestCase
    method setUp (line 21) | public function setUp(): void
    method testRegisterExceptionHandler (line 33) | public function testRegisterExceptionHandler()
    method testExceptionHandlerHandlesException (line 41) | public function testExceptionHandlerHandlesException()
    method testExceptionHandlerHandlesExceptionAndCreatesNewResponse (line 56) | public function testExceptionHandlerHandlesExceptionAndCreatesNewRespo...
    method testExceptionHandlerHandlesExceptionWithRedirectResponse (line 71) | public function testExceptionHandlerHandlesExceptionWithRedirectRespon...
    method testExceptionHandlerHandlesExceptionWithJsonResponse (line 86) | public function testExceptionHandlerHandlesExceptionWithJsonResponse()
    method testExceptionHandlerReturnsGenericWhenNoMatchingHandler (line 101) | public function testExceptionHandlerReturnsGenericWhenNoMatchingHandler()
    method testUsingMultidimensionalArrayForGenericResponse (line 112) | public function testUsingMultidimensionalArrayForGenericResponse()
    method testRegularExceptionsAreHandledByGenericHandler (line 133) | public function testRegularExceptionsAreHandledByGenericHandler()
    method testResourceExceptionErrorsAreIncludedInResponse (line 144) | public function testResourceExceptionErrorsAreIncludedInResponse()
    method testExceptionTraceIncludedInResponse (line 155) | public function testExceptionTraceIncludedInResponse()
    method testHttpExceptionsWithNoMessageUseStatusCodeMessage (line 168) | public function testHttpExceptionsWithNoMessageUseStatusCodeMessage()
    method testExceptionsHandledByRenderAreReroutedThroughHandler (line 179) | public function testExceptionsHandledByRenderAreReroutedThroughHandler()
    method testSettingUserDefinedReplacements (line 190) | public function testSettingUserDefinedReplacements()

FILE: tests/Http/Middleware/AuthTest.php
  class AuthTest (line 17) | class AuthTest extends BaseTestCase
    method setUp (line 40) | public function setUp(): void
    method testProtectedRouteFiresAuthenticationAndPasses (line 49) | public function testProtectedRouteFiresAuthenticationAndPasses()
    method testProtectedRouteAlreadyLoggedIn (line 67) | public function testProtectedRouteAlreadyLoggedIn()
    method testAuthenticationFailsAndExceptionIsThrown (line 84) | public function testAuthenticationFailsAndExceptionIsThrown()

FILE: tests/Http/Middleware/RateLimitTest.php
  class RateLimitTest (line 20) | class RateLimitTest extends BaseTestCase
    method setUp (line 43) | public function setUp(): void
    method testMiddlewareBypassesRequestsWithNoRateLimiting (line 58) | public function testMiddlewareBypassesRequestsWithNoRateLimiting()
    method testMiddlewareBypassesInternalRequest (line 81) | public function testMiddlewareBypassesInternalRequest()
    method testRateLimitingPassesAndResponseHeadersAreSet (line 104) | public function testRateLimitingPassesAndResponseHeadersAreSet()
    method testRateLimitingFailsAndHeadersAreSetOnException (line 127) | public function testRateLimitingFailsAndHeadersAreSetOnException()
    method testRateLimitingWithLimitsSetOnRoute (line 157) | public function testRateLimitingWithLimitsSetOnRoute()
    method testRateLimitingWithRouteThrottle (line 179) | public function testRateLimitingWithRouteThrottle()

FILE: tests/Http/Middleware/RequestTest.php
  class RequestTest (line 22) | class RequestTest extends BaseTestCase
    method setUp (line 51) | public function setUp(): void
    method testNoPrefixOrDomainDoesNotMatch (line 66) | public function testNoPrefixOrDomainDoesNotMatch()
    method testPrefixMatchesAndSendsRequestThroughRouter (line 79) | public function testPrefixMatchesAndSendsRequestThroughRouter()
    method testDomainMatchesAndSendsRequestThroughRouter (line 112) | public function testDomainMatchesAndSendsRequestThroughRouter()

FILE: tests/Http/Parser/AcceptTest.php
  class AcceptTest (line 10) | class AcceptTest extends BaseTestCase
    method testParsingInvalidAcceptReturnsDefaults (line 12) | public function testParsingInvalidAcceptReturnsDefaults()
    method testStrictlyParsingInvalidAcceptHeaderThrowsException (line 23) | public function testStrictlyParsingInvalidAcceptHeaderThrowsException()
    method testParsingValidAcceptReturnsHeaderValues (line 33) | public function testParsingValidAcceptReturnsHeaderValues()
    method testApiVersionWithoutVSuffix (line 44) | public function testApiVersionWithoutVSuffix()
    method testApiVersionWithHyphen (line 55) | public function testApiVersionWithHyphen()
    method createRequest (line 66) | protected function createRequest($uri, $method, array $headers = [])

FILE: tests/Http/RateLimit/HandlerTest.php
  class HandlerTest (line 13) | class HandlerTest extends BaseTestCase
    method setUp (line 28) | public function setUp(): void
    method testSettingSpecificLimitsOnRouteUsesRouteSpecificThrottle (line 41) | public function testSettingSpecificLimitsOnRouteUsesRouteSpecificThrot...
    method testThrottleWithHighestAmountOfRequestsIsUsedWhenMoreThanOneMatchingThrottle (line 52) | public function testThrottleWithHighestAmountOfRequestsIsUsedWhenMoreT...
    method testExceedingOfRateLimit (line 62) | public function testExceedingOfRateLimit()
    method testGettingTheRemainingLimit (line 77) | public function testGettingTheRemainingLimit()

FILE: tests/Http/RateLimit/Throttle/AuthenticatedTest.php
  class AuthenticatedTest (line 11) | class AuthenticatedTest extends BaseTestCase
    method testThrottleMatchesCorrectly (line 13) | public function testThrottleMatchesCorrectly()

FILE: tests/Http/RateLimit/Throttle/UnauthenticatedTest.php
  class UnauthenticatedTest (line 11) | class UnauthenticatedTest extends BaseTestCase
    method testThrottleMatchesCorrectly (line 13) | public function testThrottleMatchesCorrectly()

FILE: tests/Http/RequestValidatorTest.php
  class RequestValidatorTest (line 12) | class RequestValidatorTest extends BaseTestCase
    method setUp (line 23) | public function setUp(): void
    method testValidationFailsWithNoValidators (line 30) | public function testValidationFailsWithNoValidators()
    method testValidationFails (line 37) | public function testValidationFails()
    method testValidationPasses (line 44) | public function testValidationPasses()

FILE: tests/Http/Response/FactoryTest.php
  class FactoryTest (line 17) | class FactoryTest extends BaseTestCase
    method setUp (line 28) | public function setUp(): void
    method testMakingACreatedResponse (line 34) | public function testMakingACreatedResponse()
    method testMakingAnAcceptedResponse (line 47) | public function testMakingAnAcceptedResponse()
    method testMakingANoContentResponse (line 73) | public function testMakingANoContentResponse()
    method testMakingCollectionRegistersUnderlyingClassWithTransformer (line 81) | public function testMakingCollectionRegistersUnderlyingClassWithTransf...
    method testMakingCollectionResponseWithThreeParameters (line 89) | public function testMakingCollectionResponseWithThreeParameters()
    method testMakingItemsRegistersClassWithTransformer (line 105) | public function testMakingItemsRegistersClassWithTransformer()
    method testMakingItemResponseWithThreeParameters (line 113) | public function testMakingItemResponseWithThreeParameters()
    method testMakingPaginatorRegistersUnderlyingClassWithTransformer (line 129) | public function testMakingPaginatorRegistersUnderlyingClassWithTransfo...
    method testNotFoundThrowsHttpException (line 137) | public function testNotFoundThrowsHttpException()
    method testBadRequestThrowsHttpException (line 144) | public function testBadRequestThrowsHttpException()
    method testForbiddenThrowsHttpException (line 151) | public function testForbiddenThrowsHttpException()
    method testInternalThrowsHttpException (line 158) | public function testInternalThrowsHttpException()
    method testUnauthorizedThrowsHttpException (line 165) | public function testUnauthorizedThrowsHttpException()
    method testMethodNotAllowedThrowsHttpException (line 172) | public function testMethodNotAllowedThrowsHttpException()
    method testMakingArrayResponse (line 179) | public function testMakingArrayResponse()
    method testPrefixingWithCallsMethodsCorrectly (line 185) | public function testPrefixingWithCallsMethodsCorrectly()

FILE: tests/Http/Response/Format/JsonTest.php
  class JsonTest (line 12) | class JsonTest extends BaseTestCase
    method setUp (line 14) | public function setUp(): void
    method tearDown (line 19) | public function tearDown(): void
    method getExpectedPrettyPrintedJson (line 35) | private function getExpectedPrettyPrintedJson($testMethodName)
    method testMorphingEloquentModel (line 42) | public function testMorphingEloquentModel()
    method testMorphingEloquentCollection (line 49) | public function testMorphingEloquentCollection()
    method testMorphingEmptyEloquentCollection (line 56) | public function testMorphingEmptyEloquentCollection()
    method testMorphingString (line 63) | public function testMorphingString()
    method testMorphingArray (line 70) | public function testMorphingArray()
    method testMorphingUnknownType (line 79) | public function testMorphingUnknownType()
    method testMorphingEloquentModelWithCamelCasing (line 84) | public function testMorphingEloquentModelWithCamelCasing()
    method testMorphingEloquentCollectionWithCamelCasing (line 93) | public function testMorphingEloquentCollectionWithCamelCasing()
    method testMorphingArrayWithTwoSpacesPrettyPrintIndent (line 102) | public function testMorphingArrayWithTwoSpacesPrettyPrintIndent()
    method testMorphingArrayWithFourSpacesPrettyPrintIndent (line 121) | public function testMorphingArrayWithFourSpacesPrettyPrintIndent()
    method testMorphingArrayWithEightSpacesPrettyPrintIndent (line 140) | public function testMorphingArrayWithEightSpacesPrettyPrintIndent()
    method testMorphingArrayWithOneTabPrettyPrintIndent (line 159) | public function testMorphingArrayWithOneTabPrettyPrintIndent()

FILE: tests/Http/Response/Format/JsonpTest.php
  class JsonpTest (line 13) | class JsonpTest extends BaseTestCase
    method setUp (line 15) | public function setUp(): void
    method getExpectedPrettyPrintedJsonp (line 32) | private function getExpectedPrettyPrintedJsonp($testMethodName)
    method testMorphingEloquentModel (line 39) | public function testMorphingEloquentModel()
    method testMorphingEloquentCollection (line 46) | public function testMorphingEloquentCollection()
    method testMorphingEmptyEloquentCollection (line 53) | public function testMorphingEmptyEloquentCollection()
    method testMorphingString (line 60) | public function testMorphingString()
    method testMorphingArray (line 67) | public function testMorphingArray()
    method testMorphingUnknownType (line 76) | public function testMorphingUnknownType()
    method testMorphingArrayWithOneTabPrettyPrintIndent (line 81) | public function testMorphingArrayWithOneTabPrettyPrintIndent()
    method testMorphingArrayWithTwoSpacesPrettyPrintIndent (line 98) | public function testMorphingArrayWithTwoSpacesPrettyPrintIndent()
    method testMorphingArrayWithFourSpacesPrettyPrintIndent (line 116) | public function testMorphingArrayWithFourSpacesPrettyPrintIndent()
    method testMorphingArrayWithEightSpacesPrettyPrintIndent (line 134) | public function testMorphingArrayWithEightSpacesPrettyPrintIndent()

FILE: tests/Http/ResponseTest.php
  class ResponseTest (line 17) | class ResponseTest extends BaseTestCase
    method setUp (line 24) | public function setUp(): void
    method testGettingInvalidFormatterThrowsException (line 29) | public function testGettingInvalidFormatterThrowsException()
    method testNonCastableObjectsSetAsOriginalContent (line 37) | public function testNonCastableObjectsSetAsOriginalContent()
    method testAddingAndSettingMetaCallsUnderlyingTransformerBinding (line 48) | public function testAddingAndSettingMetaCallsUnderlyingTransformerBind...
    method testBuildingWithCustomStatusCodeAndHeaders (line 59) | public function testBuildingWithCustomStatusCodeAndHeaders()
    method testChangingContentWithEvents (line 69) | public function testChangingContentWithEvents()
    method testChangingResponseHeadersWithEvents (line 84) | public function testChangingResponseHeadersWithEvents()

FILE: tests/Http/Validation/AcceptTest.php
  class AcceptTest (line 10) | class AcceptTest extends BaseTestCase
    method testValidationPassesForStrictModeAndOptionsRequests (line 12) | public function testValidationPassesForStrictModeAndOptionsRequests()

FILE: tests/Http/Validation/DomainTest.php
  class DomainTest (line 9) | class DomainTest extends BaseTestCase
    method testValidationFailsWithInvalidOrNullDomain (line 11) | public function testValidationFailsWithInvalidOrNullDomain()
    method testValidationPasses (line 20) | public function testValidationPasses()
    method testValidationPassesWithDifferentProtocols (line 26) | public function testValidationPassesWithDifferentProtocols()
    method testValidationPassesWithPortOnDomain (line 35) | public function testValidationPassesWithPortOnDomain()
    method testValidationPassesWithPortOnRequest (line 41) | public function testValidationPassesWithPortOnRequest()
    method testValidationPassesWithPortOnDomainAndRequest (line 47) | public function testValidationPassesWithPortOnDomainAndRequest()

FILE: tests/Http/Validation/PrefixTest.php
  class PrefixTest (line 9) | class PrefixTest extends BaseTestCase
    method testValidationFailsWithInvalidOrNullPrefix (line 11) | public function testValidationFailsWithInvalidOrNullPrefix()
    method testValidationPasses (line 20) | public function testValidationPasses()
    method testValidationPassesWithHyphenatedPrefix (line 27) | public function testValidationPassesWithHyphenatedPrefix()

FILE: tests/Routing/Adapter/BaseAdapterTest.php
  class BaseAdapterTest (line 16) | abstract class BaseAdapterTest extends BaseTestCase
    method setUp (line 35) | public function setUp(): void
    method getContainerInstance (line 57) | abstract public function getContainerInstance();
    method getAdapterInstance (line 62) | abstract public function getAdapterInstance();
    method createRequest (line 64) | protected function createRequest($uri, $method, array $headers = [])
    method testBasicRouteVersions (line 75) | public function testBasicRouteVersions()
    method testAdapterDispatchesRequestsThroughRouter (line 138) | public function testAdapterDispatchesRequestsThroughRouter()
    method testRoutesWithPrefix (line 153) | public function testRoutesWithPrefix()
    method testRoutesWithDomains (line 171) | public function testRoutesWithDomains()
    method testPointReleaseVersions (line 189) | public function testPointReleaseVersions()
    method testRoutingResources (line 210) | public function testRoutingResources()
    method testIterableRoutes (line 223) | public function testIterableRoutes()

FILE: tests/Routing/Adapter/LaravelTest.php
  class LaravelTest (line 10) | class LaravelTest extends BaseAdapterTest
    method getAdapterInstance (line 12) | public function getAdapterInstance()
    method getContainerInstance (line 17) | public function getContainerInstance()

FILE: tests/Routing/Adapter/LumenTest.php
  class LumenTest (line 12) | class LumenTest extends BaseAdapterTest
    method getAdapterInstance (line 14) | public function getAdapterInstance()
    method getContainerInstance (line 33) | public function getContainerInstance()
    method testRoutesWithDomains (line 38) | public function testRoutesWithDomains()

FILE: tests/Routing/RouteTest.php
  class RouteTest (line 15) | class RouteTest extends BaseTestCase
    method setUp (line 26) | public function setUp(): void
    method testCreatingNewRoute (line 32) | public function testCreatingNewRoute()
    method testControllerOptionsMergeAndOverrideRouteOptions (line 56) | public function testControllerOptionsMergeAndOverrideRouteOptions()

FILE: tests/Routing/RouterTest.php
  class RouterTest (line 16) | class RouterTest extends Adapter\BaseAdapterTest
    method getAdapterInstance (line 18) | public function getAdapterInstance()
    method getContainerInstance (line 23) | public function getContainerInstance()
    method testRouteOptionsMergeCorrectly (line 28) | public function testRouteOptionsMergeCorrectly()
    method testGroupAsPrefixesRouteAs (line 70) | public function testGroupAsPrefixesRouteAs()
    method testNoGroupVersionThrowsException (line 83) | public function testNoGroupVersionThrowsException()
    method testMatchRoutes (line 93) | public function testMatchRoutes()
    method testAnyRoutes (line 118) | public function testAnyRoutes()
    method testRouterPreparesNotModifiedResponse (line 157) | public function testRouterPreparesNotModifiedResponse()
    method testRouterHandlesExistingEtag (line 205) | public function testRouterHandlesExistingEtag()
    method testRouterHandlesCustomEtag (line 225) | public function testRouterHandlesCustomEtag()
    method testExceptionsAreHandledByExceptionHandler (line 248) | public function testExceptionsAreHandledByExceptionHandler()
    method testNoAcceptHeaderUsesDefaultVersion (line 266) | public function testNoAcceptHeaderUsesDefaultVersion()
    method testRoutesAddedToCorrectVersions (line 277) | public function testRoutesAddedToCorrectVersions()
    method testUnsuccessfulResponseThrowsHttpException (line 296) | public function testUnsuccessfulResponseThrowsHttpException()
    method testGroupNamespacesAreConcatenated (line 311) | public function testGroupNamespacesAreConcatenated()
    method testCurrentRouteName (line 324) | public function testCurrentRouteName()
    method testCurrentRouteAction (line 343) | public function testCurrentRouteAction()
    method testRoutePatternsAreAppliedCorrectly (line 360) | public function testRoutePatternsAreAppliedCorrectly()

FILE: tests/Stubs/Application58Stub.php
  class Application58Stub (line 9) | class Application58Stub extends Container implements Application
    method version (line 11) | public function version()
    method basePath (line 16) | public function basePath()
    method bootstrapPath (line 21) | public function bootstrapPath($path = '')
    method configPath (line 26) | public function configPath($path = '')
    method databasePath (line 31) | public function databasePath($path = '')
    method environmentPath (line 36) | public function environmentPath()
    method resourcePath (line 41) | public function resourcePath($path = '')
    method storagePath (line 46) | public function storagePath()
    method environment (line 51) | public function environment(...$environments)
    method runningInConsole (line 56) | public function runningInConsole()
    method runningUnitTests (line 61) | public function runningUnitTests()
    method isDownForMaintenance (line 66) | public function isDownForMaintenance()
    method registerConfiguredProviders (line 71) | public function registerConfiguredProviders()
    method register (line 76) | public function register($provider, $options = [], $force = false)
    method registerDeferredProvider (line 81) | public function registerDeferredProvider($provider, $service = null)
    method resolveProvider (line 86) | public function resolveProvider($provider)
    method boot (line 91) | public function boot()
    method booting (line 96) | public function booting($callback)
    method booted (line 101) | public function booted($callback)
    method bootstrapWith (line 106) | public function bootstrapWith(array $bootstrappers)
    method configurationIsCached (line 111) | public function configurationIsCached()
    method detectEnvironment (line 116) | public function detectEnvironment(Closure $callback)
    method environmentFile (line 121) | public function environmentFile()
    method environmentFilePath (line 126) | public function environmentFilePath()
    method getCachedConfigPath (line 131) | public function getCachedConfigPath()
    method getCachedServicesPath (line 136) | public function getCachedServicesPath()
    method getCachedPackagesPath (line 141) | public function getCachedPackagesPath()
    method getCachedRoutesPath (line 146) | public function getCachedRoutesPath()
    method getLocale (line 151) | public function getLocale()
    method getNamespace (line 156) | public function getNamespace()
    method getProviders (line 161) | public function getProviders($provider)
    method hasBeenBootstrapped (line 166) | public function hasBeenBootstrapped()
    method loadDeferredProviders (line 171) | public function loadDeferredProviders()
    method loadEnvironmentFrom (line 176) | public function loadEnvironmentFrom($file)
    method routesAreCached (line 181) | public function routesAreCached()
    method setLocale (line 186) | public function setLocale($locale)
    method shouldSkipMiddleware (line 191) | public function shouldSkipMiddleware()
    method terminate (line 196) | public function terminate()

FILE: tests/Stubs/Application6Stub.php
  class Application6Stub (line 9) | class Application6Stub extends Container implements Application
    method version (line 11) | public function version()
    method basePath (line 16) | public function basePath($path = '')
    method bootstrapPath (line 21) | public function bootstrapPath($path = '')
    method configPath (line 26) | public function configPath($path = '')
    method databasePath (line 31) | public function databasePath($path = '')
    method environmentPath (line 36) | public function environmentPath()
    method resourcePath (line 41) | public function resourcePath($path = '')
    method storagePath (line 46) | public function storagePath()
    method environment (line 51) | public function environment(...$environments)
    method runningInConsole (line 56) | public function runningInConsole()
    method runningUnitTests (line 61) | public function runningUnitTests()
    method isDownForMaintenance (line 66) | public function isDownForMaintenance()
    method registerConfiguredProviders (line 71) | public function registerConfiguredProviders()
    method register (line 76) | public function register($provider, $options = [], $force = false)
    method registerDeferredProvider (line 81) | public function registerDeferredProvider($provider, $service = null)
    method resolveProvider (line 86) | public function resolveProvider($provider)
    method boot (line 91) | public function boot()
    method booting (line 96) | public function booting($callback)
    method booted (line 101) | public function booted($callback)
    method bootstrapWith (line 106) | public function bootstrapWith(array $bootstrappers)
    method configurationIsCached (line 111) | public function configurationIsCached()
    method detectEnvironment (line 116) | public function detectEnvironment(Closure $callback)
    method environmentFile (line 121) | public function environmentFile()
    method environmentFilePath (line 126) | public function environmentFilePath()
    method getCachedConfigPath (line 131) | public function getCachedConfigPath()
    method getCachedServicesPath (line 136) | public function getCachedServicesPath()
    method getCachedPackagesPath (line 141) | public function getCachedPackagesPath()
    method getCachedRoutesPath (line 146) | public function getCachedRoutesPath()
    method getLocale (line 151) | public function getLocale()
    method getNamespace (line 156) | public function getNamespace()
    method getProviders (line 161) | public function getProviders($provider)
    method hasBeenBootstrapped (line 166) | public function hasBeenBootstrapped()
    method loadDeferredProviders (line 171) | public function loadDeferredProviders()
    method loadEnvironmentFrom (line 176) | public function loadEnvironmentFrom($file)
    method routesAreCached (line 181) | public function routesAreCached()
    method setLocale (line 186) | public function setLocale($locale)
    method shouldSkipMiddleware (line 191) | public function shouldSkipMiddleware()
    method terminate (line 196) | public function terminate()

FILE: tests/Stubs/Application7Stub.php
  class Application7Stub (line 8) | class Application7Stub extends Container implements Application
    method version (line 10) | public function version()
    method basePath (line 15) | public function basePath($path = '')
    method bootstrapPath (line 20) | public function bootstrapPath($path = '')
    method configPath (line 25) | public function configPath($path = '')
    method databasePath (line 30) | public function databasePath($path = '')
    method environmentPath (line 35) | public function environmentPath()
    method resourcePath (line 40) | public function resourcePath($path = '')
    method storagePath (line 45) | public function storagePath()
    method environment (line 50) | public function environment(...$environments)
    method runningInConsole (line 55) | public function runningInConsole()
    method runningUnitTests (line 60) | public function runningUnitTests()
    method isDownForMaintenance (line 65) | public function isDownForMaintenance()
    method registerConfiguredProviders (line 70) | public function registerConfiguredProviders()
    method register (line 75) | public function register($provider, $options = [], $force = false)
    method registerDeferredProvider (line 80) | public function registerDeferredProvider($provider, $service = null)
    method resolveProvider (line 85) | public function resolveProvider($provider)
    method boot (line 90) | public function boot()
    method booting (line 95) | public function booting($callback)
    method booted (line 100) | public function booted($callback)
    method bootstrapWith (line 105) | public function bootstrapWith(array $bootstrappers)
    method configurationIsCached (line 110) | public function configurationIsCached()
    method detectEnvironment (line 115) | public function detectEnvironment(\Closure $callback)
    method environmentFile (line 120) | public function environmentFile()
    method environmentFilePath (line 125) | public function environmentFilePath()
    method getCachedConfigPath (line 130) | public function getCachedConfigPath()
    method getCachedServicesPath (line 135) | public function getCachedServicesPath()
    method getCachedPackagesPath (line 140) | public function getCachedPackagesPath()
    method getCachedRoutesPath (line 145) | public function getCachedRoutesPath()
    method getLocale (line 150) | public function getLocale()
    method getNamespace (line 155) | public function getNamespace()
    method getProviders (line 160) | public function getProviders($provider)
    method hasBeenBootstrapped (line 165) | public function hasBeenBootstrapped()
    method loadDeferredProviders (line 170) | public function loadDeferredProviders()
    method loadEnvironmentFrom (line 175) | public function loadEnvironmentFrom($file)
    method routesAreCached (line 180) | public function routesAreCached()
    method setLocale (line 185) | public function setLocale($locale)
    method shouldSkipMiddleware (line 190) | public function shouldSkipMiddleware()
    method terminate (line 195) | public function terminate()

FILE: tests/Stubs/Application8Stub.php
  class Application8Stub (line 8) | class Application8Stub extends Container implements Application
    method version (line 10) | public function version()
    method basePath (line 15) | public function basePath($path = '')
    method bootstrapPath (line 20) | public function bootstrapPath($path = '')
    method configPath (line 25) | public function configPath($path = '')
    method databasePath (line 30) | public function databasePath($path = '')
    method environmentPath (line 35) | public function environmentPath()
    method resourcePath (line 40) | public function resourcePath($path = '')
    method storagePath (line 45) | public function storagePath()
    method environment (line 50) | public function environment(...$environments)
    method runningInConsole (line 55) | public function runningInConsole()
    method runningUnitTests (line 60) | public function runningUnitTests()
    method isDownForMaintenance (line 65) | public function isDownForMaintenance()
    method registerConfiguredProviders (line 70) | public function registerConfiguredProviders()
    method register (line 75) | public function register($provider, $options = [], $force = false)
    method registerDeferredProvider (line 80) | public function registerDeferredProvider($provider, $service = null)
    method resolveProvider (line 85) | public function resolveProvider($provider)
    method boot (line 90) | public function boot()
    method booting (line 95) | public function booting($callback)
    method booted (line 100) | public function booted($callback)
    method bootstrapWith (line 105) | public function bootstrapWith(array $bootstrappers)
    method configurationIsCached (line 110) | public function configurationIsCached()
    method detectEnvironment (line 115) | public function detectEnvironment(\Closure $callback)
    method environmentFile (line 120) | public function environmentFile()
    method environmentFilePath (line 125) | public function environmentFilePath()
    method getCachedConfigPath (line 130) | public function getCachedConfigPath()
    method getCachedServicesPath (line 135) | public function getCachedServicesPath()
    method getCachedPackagesPath (line 140) | public function getCachedPackagesPath()
    method getCachedRoutesPath (line 145) | public function getCachedRoutesPath()
    method getLocale (line 150) | public function getLocale()
    method getNamespace (line 155) | public function getNamespace()
    method getProviders (line 160) | public function getProviders($provider)
    method hasBeenBootstrapped (line 165) | public function hasBeenBootstrapped()
    method loadDeferredProviders (line 170) | public function loadDeferredProviders()
    method loadEnvironmentFrom (line 175) | public function loadEnvironmentFrom($file)
    method routesAreCached (line 180) | public function routesAreCached()
    method setLocale (line 185) | public function setLocale($locale)
    method shouldSkipMiddleware (line 190) | public function shouldSkipMiddleware()
    method terminate (line 195) | public function terminate()

FILE: tests/Stubs/ApplicationStub.php
  class ApplicationStub (line 8) | class ApplicationStub extends Container implements Application
    method version (line 10) | public function version()
    method basePath (line 15) | public function basePath()
    method environment (line 20) | public function environment()
    method isDownForMaintenance (line 25) | public function isDownForMaintenance()
    method registerConfiguredProviders (line 30) | public function registerConfiguredProviders()
    method register (line 35) | public function register($provider, $options = [], $force = false)
    method runningUnitTests (line 40) | public function runningUnitTests()
    method registerDeferredProvider (line 45) | public function registerDeferredProvider($provider, $service = null)
    method getCachedCompilePath (line 50) | public function getCachedCompilePath()
    method getCachedServicesPath (line 55) | public function getCachedServicesPath()
    method boot (line 60) | public function boot()
    method booting (line 65) | public function booting($callback)
    method booted (line 70) | public function booted($callback)
    method getCachedPackagesPath (line 75) | public function getCachedPackagesPath()
    method runningInConsole (line 80) | public function runningInConsole()

FILE: tests/Stubs/AuthorizationProviderStub.php
  class AuthorizationProviderStub (line 9) | class AuthorizationProviderStub extends Authorization
    method authenticate (line 11) | public function authenticate(Request $request, Route $route)
    method getAuthorizationMethod (line 16) | public function getAuthorizationMethod()

FILE: tests/Stubs/BasicThrottleStub.php
  class BasicThrottleStub (line 8) | class BasicThrottleStub implements Throttle
    method match (line 10) | public function match(Container $app)
    method getLimit (line 15) | public function getLimit()
    method getExpires (line 20) | public function getExpires()

FILE: tests/Stubs/EloquentModelStub.php
  class EloquentModelStub (line 7) | class EloquentModelStub extends Model
    method toArray (line 11) | public function toArray()

FILE: tests/Stubs/HttpValidatorStub.php
  class HttpValidatorStub (line 8) | class HttpValidatorStub implements Validator
    method validate (line 10) | public function validate(Request $request)

FILE: tests/Stubs/MiddlewareStub.php
  class MiddlewareStub (line 7) | class MiddlewareStub
    method handle (line 9) | public function handle($request, Closure $next)

FILE: tests/Stubs/RoutingAdapterStub.php
  class RoutingAdapterStub (line 16) | class RoutingAdapterStub implements Adapter
    method dispatch (line 22) | public function dispatch(Request $request, $version)
    method findRouteClosure (line 40) | protected function findRouteClosure(array $action)
    method prepareResponse (line 49) | protected function prepareResponse($request, $response)
    method findRoute (line 62) | protected function findRoute(Request $request, $routeCollection)
    method getRouteProperties (line 67) | public function getRouteProperties($route, Request $request)
    method addRoute (line 72) | public function addRoute(array $methods, array $versions, $uri, $action)
    method getRoutes (line 86) | public function getRoutes($version = null)
    method getIterableRoutes (line 95) | public function getIterableRoutes($version = null)
    method setRoutes (line 100) | public function setRoutes(array $routes)
    method prepareRouteForSerialization (line 105) | public function prepareRouteForSerialization($route)
    method pattern (line 110) | public function pattern($key, $pattern)
    method getPatterns (line 115) | public function getPatterns()
    method createRouteCollections (line 120) | protected function createRouteCollections(array $versions)
    method addWhereClausesToRoute (line 129) | protected function addWhereClausesToRoute($route)

FILE: tests/Stubs/RoutingControllerOtherStub.php
  class RoutingControllerOtherStub (line 7) | class RoutingControllerOtherStub extends Controller
    method find (line 9) | public function find()

FILE: tests/Stubs/RoutingControllerStub.php
  class RoutingControllerStub (line 8) | class RoutingControllerStub extends Controller
    method __construct (line 12) | public function __construct()
    method index (line 24) | public function index()
    method show (line 29) | public function show()
    method getIndex (line 34) | public function getIndex()

FILE: tests/Stubs/ThrottleStub.php
  class ThrottleStub (line 8) | class ThrottleStub extends Throttle
    method __construct (line 12) | public function __construct(array $options = ['limit' => 60, 'expires'...
    method match (line 19) | public function match(Container $app)

FILE: tests/Stubs/TransformerStub.php
  class TransformerStub (line 10) | class TransformerStub implements Adapter
    method transform (line 12) | public function transform($response, $transformer, Binding $binding, R...

FILE: tests/Stubs/UserStub.php
  class UserStub (line 5) | class UserStub
    method __construct (line 9) | public function __construct($name)

FILE: tests/Stubs/UserTransformerStub.php
  class UserTransformerStub (line 5) | class UserTransformerStub
    method transform (line 7) | public function transform(UserStub $user)

FILE: tests/Transformer/Adapter/FractalTest.php
  class FractalTest (line 10) | class FractalTest extends BaseTestCase
    method setUp (line 14) | public function setUp(): void
    method testParseFractalIncludes (line 19) | public function testParseFractalIncludes()
    method testParseFractalIncludesWithSpaces (line 28) | public function testParseFractalIncludesWithSpaces()

FILE: tests/Transformer/FactoryTest.php
  class FactoryTest (line 15) | class FactoryTest extends BaseTestCase
    method setUp (line 22) | public function setUp(): void
    method testResponseIsTransformable (line 30) | public function testResponseIsTransformable()
    method testRegisterParameterOrder (line 39) | public function testRegisterParameterOrder()
    method testResponseIsTransformableType (line 65) | public function testResponseIsTransformableType()
    method testTransformingResponse (line 72) | public function testTransformingResponse()
    method testTransformingCollectionResponse (line 81) | public function testTransformingCollectionResponse()
    method testTransforingWithIlluminateRequest (line 90) | public function testTransforingWithIlluminateRequest()
    method testTransformingWithNoTransformerThrowsException (line 104) | public function testTransformingWithNoTransformerThrowsException()
Condensed preview — 140 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (428K chars).
[
  {
    "path": ".editorconfig",
    "chars": 176,
    "preview": "root = true\n\n[*]\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\nindent_style = space\nindent"
  },
  {
    "path": ".gitattributes",
    "chars": 282,
    "preview": "/tests export-ignore\n/.editorconfig export-ignore\n/.gitattributes export-ignore\n/.gitignore export-ignore\n/.php_cs expor"
  },
  {
    "path": ".github/ISSUE_TEMPLATE.md",
    "chars": 798,
    "preview": "| Q                 | A\n| ----------------- | ---\n| Bug?              | no|yes\n| New Feature?      | no|yes\n| Framework "
  },
  {
    "path": ".gitignore",
    "chars": 69,
    "preview": ".php_cs.cache\n.idea\ncomposer.lock\nphpunit.xml\nstorage\nvendor\n.php_cs\n"
  },
  {
    "path": ".styleci.yml",
    "chars": 127,
    "preview": "preset: laravel\n\ndisabled:\n  - alpha_ordered_imports\n\nenabled:\n  - phpdoc_order\n  - phpdoc_separation\n  - unalign_double"
  },
  {
    "path": ".travis.yml",
    "chars": 798,
    "preview": "language: php\n\nsudo: false\ndist: trusty\n\nenv:\n  global:\n    - setup=basic\n    - xdebug=true\n\ncache:\n  directories:\n    -"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 1363,
    "preview": "# CONTRIBUTING\n\nContributions are welcome, and are accepted via pull requests. Please review these guidelines before sub"
  },
  {
    "path": "LICENSE",
    "chars": 1483,
    "preview": "Copyright (c) 2014-2015, Jason Lewis\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or wi"
  },
  {
    "path": "composer.json",
    "chars": 1989,
    "preview": "{\n    \"name\": \"dingo/api\",\n    \"description\": \"A RESTful API package for the Laravel and Lumen frameworks.\",\n    \"keywor"
  },
  {
    "path": "config/api.php",
    "chars": 7348,
    "preview": "<?php\n\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Standards "
  },
  {
    "path": "phpunit.xml.dist",
    "chars": 992,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit backupGlobals=\"false\"\n         backupStaticAttributes=\"false\"\n         b"
  },
  {
    "path": "readme.md",
    "chars": 2352,
    "preview": "# Move repositories notice\nUnfortunately this package cannot be maintained at this location anymore due to broken CI int"
  },
  {
    "path": "src/Auth/Auth.php",
    "chars": 5674,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Auth;\n\nuse Exception;\nuse Dingo\\Api\\Routing\\Router;\nuse Illuminate\\Container\\Container;\nuse S"
  },
  {
    "path": "src/Auth/Provider/Authorization.php",
    "chars": 1035,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Auth\\Provider;\n\nuse Illuminate\\Support\\Str;\nuse Illuminate\\Http\\Request;\nuse Symfony\\Componen"
  },
  {
    "path": "src/Auth/Provider/Basic.php",
    "chars": 1571,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Auth\\Provider;\n\nuse Dingo\\Api\\Routing\\Route;\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Auth"
  },
  {
    "path": "src/Auth/Provider/JWT.php",
    "chars": 2386,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Auth\\Provider;\n\nuse Exception;\nuse Tymon\\JWTAuth\\JWTAuth;\nuse Dingo\\Api\\Routing\\Route;\nuse Il"
  },
  {
    "path": "src/Console/Command/Cache.php",
    "chars": 2780,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Console\\Command;\n\nuse Dingo\\Api\\Routing\\Router;\nuse Illuminate\\Console\\Command;\nuse Illuminat"
  },
  {
    "path": "src/Console/Command/Docs.php",
    "chars": 5511,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Console\\Command;\n\nuse ReflectionClass;\nuse Dingo\\Blueprint\\Writer;\nuse Illuminate\\Support\\Arr"
  },
  {
    "path": "src/Console/Command/Routes.php",
    "chars": 7316,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Console\\Command;\n\nuse Illuminate\\Support\\Arr;\nuse Illuminate\\Support\\Str;\nuse Dingo\\Api\\Routi"
  },
  {
    "path": "src/Contract/Auth/Provider.php",
    "chars": 412,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Auth;\n\nuse Dingo\\Api\\Routing\\Route;\nuse Illuminate\\Http\\Request;\n\ninterface Provider"
  },
  {
    "path": "src/Contract/Debug/ExceptionHandler.php",
    "chars": 261,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Debug;\n\ninterface ExceptionHandler\n{\n    /**\n     * Handle an exception.\n     *\n    "
  },
  {
    "path": "src/Contract/Debug/MessageBagErrors.php",
    "chars": 337,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Debug;\n\ninterface MessageBagErrors\n{\n    /**\n     * Get the errors message bag.\n    "
  },
  {
    "path": "src/Contract/Http/Parser.php",
    "chars": 303,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Http;\n\nuse Illuminate\\Http\\Request as IlluminateRequest;\n\ninterface Parser\n{\n    /**"
  },
  {
    "path": "src/Contract/Http/RateLimit/HasRateLimiter.php",
    "chars": 409,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Http\\RateLimit;\n\nuse Dingo\\Api\\Http\\Request;\nuse Illuminate\\Container\\Container;\n\nin"
  },
  {
    "path": "src/Contract/Http/RateLimit/Throttle.php",
    "chars": 602,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Http\\RateLimit;\n\nuse Illuminate\\Container\\Container;\n\ninterface Throttle\n{\n    /**\n "
  },
  {
    "path": "src/Contract/Http/Request.php",
    "chars": 375,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Http;\n\nuse Illuminate\\Http\\Request as IlluminateRequest;\n\ninterface Request\n{\n    /*"
  },
  {
    "path": "src/Contract/Http/Validator.php",
    "chars": 301,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Http;\n\nuse Illuminate\\Http\\Request as IlluminateRequest;\n\ninterface Validator\n{\n    "
  },
  {
    "path": "src/Contract/Routing/Adapter.php",
    "chars": 1732,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Routing;\n\nuse Illuminate\\Http\\Request;\n\ninterface Adapter\n{\n    /**\n     * Dispatch "
  },
  {
    "path": "src/Contract/Transformer/Adapter.php",
    "chars": 548,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Contract\\Transformer;\n\nuse Dingo\\Api\\Http\\Request;\nuse Dingo\\Api\\Transformer\\Binding;\n\ninterf"
  },
  {
    "path": "src/Dispatcher.php",
    "chars": 16474,
    "preview": "<?php\n\nnamespace Dingo\\Api;\n\nuse Dingo\\Api\\Auth\\Auth;\nuse Illuminate\\Support\\Str;\nuse Dingo\\Api\\Routing\\Router;\nuse Ding"
  },
  {
    "path": "src/Event/RequestWasMatched.php",
    "chars": 731,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Event;\n\nuse Dingo\\Api\\Http\\Request;\nuse Illuminate\\Contracts\\Container\\Container;\n\nclass Requ"
  },
  {
    "path": "src/Event/ResponseIsMorphing.php",
    "chars": 720,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Event;\n\nuse Dingo\\Api\\Http\\Response;\n\nclass ResponseIsMorphing\n{\n    /**\n     * Response inst"
  },
  {
    "path": "src/Event/ResponseWasMorphed.php",
    "chars": 98,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Event;\n\nclass ResponseWasMorphed extends ResponseIsMorphing\n{\n    //\n}\n"
  },
  {
    "path": "src/Exception/DeleteResourceFailedException.php",
    "chars": 112,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nclass DeleteResourceFailedException extends ResourceException\n{\n    //\n}\n"
  },
  {
    "path": "src/Exception/Handler.php",
    "chars": 10621,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nuse Dingo\\Api\\Http\\Request;\nuse Exception;\nuse Illuminate\\Database\\Eloquent\\Model"
  },
  {
    "path": "src/Exception/InternalHttpException.php",
    "chars": 1221,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nuse Exception;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Compone"
  },
  {
    "path": "src/Exception/RateLimitExceededException.php",
    "chars": 795,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nuse Exception;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\n\nclass R"
  },
  {
    "path": "src/Exception/ResourceException.php",
    "chars": 1533,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nuse Exception;\nuse Illuminate\\Support\\MessageBag;\nuse Dingo\\Api\\Contract\\Debug\\Me"
  },
  {
    "path": "src/Exception/StoreResourceFailedException.php",
    "chars": 111,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nclass StoreResourceFailedException extends ResourceException\n{\n    //\n}\n"
  },
  {
    "path": "src/Exception/UnknownVersionException.php",
    "chars": 605,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nuse Exception;\nuse Symfony\\Component\\HttpKernel\\Exception\\HttpException;\n\nclass U"
  },
  {
    "path": "src/Exception/UpdateResourceFailedException.php",
    "chars": 112,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nclass UpdateResourceFailedException extends ResourceException\n{\n    //\n}\n"
  },
  {
    "path": "src/Exception/ValidationHttpException.php",
    "chars": 644,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Exception;\n\nuse Exception;\n\nclass ValidationHttpException extends ResourceException\n{\n    /**"
  },
  {
    "path": "src/Facade/API.php",
    "chars": 2350,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Facade;\n\nuse Dingo\\Api\\Http\\InternalRequest;\nuse Illuminate\\Support\\Facades\\Facade;\n\nclass AP"
  },
  {
    "path": "src/Facade/Route.php",
    "chars": 292,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Facade;\n\nuse Illuminate\\Support\\Facades\\Facade;\n\nclass Route extends Facade\n{\n    /**\n     * "
  },
  {
    "path": "src/Http/FormRequest.php",
    "chars": 6658,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http;\n\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Http\\JsonResponse;\nuse Illuminate\\Contract"
  },
  {
    "path": "src/Http/InternalRequest.php",
    "chars": 618,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http;\n\nclass InternalRequest extends Request\n{\n    public function __construct(array $query ="
  },
  {
    "path": "src/Http/Middleware/Auth.php",
    "chars": 1183,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Middleware;\n\nuse Closure;\nuse Dingo\\Api\\Routing\\Router;\nuse Dingo\\Api\\Auth\\Auth as Authe"
  },
  {
    "path": "src/Http/Middleware/PrepareController.php",
    "chars": 1134,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Middleware;\n\nuse Closure;\nuse Dingo\\Api\\Routing\\Router;\n\nclass PrepareController\n{\n    /"
  },
  {
    "path": "src/Http/Middleware/RateLimit.php",
    "chars": 2711,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Middleware;\n\nuse Closure;\nuse Dingo\\Api\\Http\\Response;\nuse Dingo\\Api\\Routing\\Router;\nuse"
  },
  {
    "path": "src/Http/Middleware/Request.php",
    "chars": 6283,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Middleware;\n\nuse Closure;\nuse Exception;\nuse Dingo\\Api\\Routing\\Router;\nuse Laravel\\Lumen"
  },
  {
    "path": "src/Http/Parser/Accept.php",
    "chars": 2123,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Parser;\n\nuse Illuminate\\Http\\Request;\nuse Dingo\\Api\\Contract\\Http\\Parser;\nuse Symfony\\Co"
  },
  {
    "path": "src/Http/RateLimit/Handler.php",
    "chars": 8165,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\RateLimit;\n\nuse Dingo\\Api\\Http\\Request;\nuse Illuminate\\Support\\Carbon;\nuse Illuminate\\Ca"
  },
  {
    "path": "src/Http/RateLimit/Throttle/Authenticated.php",
    "chars": 423,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\RateLimit\\Throttle;\n\nuse Illuminate\\Container\\Container;\n\nclass Authenticated extends Th"
  },
  {
    "path": "src/Http/RateLimit/Throttle/Route.php",
    "chars": 357,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\RateLimit\\Throttle;\n\nuse Illuminate\\Container\\Container;\n\nclass Route extends Throttle\n{"
  },
  {
    "path": "src/Http/RateLimit/Throttle/Throttle.php",
    "chars": 935,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\RateLimit\\Throttle;\n\nuse Dingo\\Api\\Contract\\Http\\RateLimit\\Throttle as RateLimitThrottle"
  },
  {
    "path": "src/Http/RateLimit/Throttle/Unauthenticated.php",
    "chars": 433,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\RateLimit\\Throttle;\n\nuse Illuminate\\Container\\Container;\n\nclass Unauthenticated extends "
  },
  {
    "path": "src/Http/Request.php",
    "chars": 2586,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http;\n\nuse Dingo\\Api\\Http\\Parser\\Accept;\nuse Illuminate\\Http\\Request as IlluminateRequest;\nus"
  },
  {
    "path": "src/Http/RequestValidator.php",
    "chars": 2385,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http;\n\nuse Illuminate\\Container\\Container;\nuse Dingo\\Api\\Http\\Validation\\Accept;\nuse Dingo\\Ap"
  },
  {
    "path": "src/Http/Response/Factory.php",
    "chars": 9185,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Response;\n\nuse Closure;\nuse ErrorException;\nuse Illuminate\\Support\\Str;\nuse Dingo\\Api\\Ht"
  },
  {
    "path": "src/Http/Response/Format/Format.php",
    "chars": 2035,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Response\\Format;\n\nabstract class Format\n{\n    /**\n     * Illuminate request instance.\n  "
  },
  {
    "path": "src/Http/Response/Format/Json.php",
    "chars": 3191,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Response\\Format;\n\nuse Illuminate\\Support\\Str;\nuse Illuminate\\Contracts\\Support\\Arrayable"
  },
  {
    "path": "src/Http/Response/Format/JsonOptionalFormatting.php",
    "chars": 5669,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Response\\Format;\n\ntrait JsonOptionalFormatting\n{\n    /*\n     * Supported JSON pretty pri"
  },
  {
    "path": "src/Http/Response/Format/Jsonp.php",
    "chars": 1534,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Response\\Format;\n\nclass Jsonp extends Json\n{\n    /**\n     * Name of JSONP callback param"
  },
  {
    "path": "src/Http/Response.php",
    "chars": 10849,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http;\n\nuse ArrayObject;\nuse Illuminate\\Support\\Str;\nuse UnexpectedValueException;\nuse Illumin"
  },
  {
    "path": "src/Http/Validation/Accept.php",
    "chars": 1613,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Validation;\n\nuse Illuminate\\Http\\Request;\nuse Dingo\\Api\\Contract\\Http\\Validator;\nuse Din"
  },
  {
    "path": "src/Http/Validation/Domain.php",
    "chars": 1728,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Validation;\n\nuse Illuminate\\support\\Str;\nuse Illuminate\\Http\\Request;\nuse Dingo\\Api\\Cont"
  },
  {
    "path": "src/Http/Validation/Prefix.php",
    "chars": 1164,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Http\\Validation;\n\nuse Illuminate\\Http\\Request;\nuse Dingo\\Api\\Contract\\Http\\Validator;\n\nclass "
  },
  {
    "path": "src/Provider/DingoServiceProvider.php",
    "chars": 5838,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Provider;\n\nuse RuntimeException;\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Dispatcher;\nuse Dingo"
  },
  {
    "path": "src/Provider/HttpServiceProvider.php",
    "chars": 4028,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Provider;\n\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Routing\\Router;\nuse Dingo\\Api\\Http\\Middlewa"
  },
  {
    "path": "src/Provider/LaravelServiceProvider.php",
    "chars": 6109,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Provider;\n\nuse ReflectionClass;\nuse Dingo\\Api\\Http\\FormRequest;\nuse Illuminate\\Routing\\Redire"
  },
  {
    "path": "src/Provider/LumenServiceProvider.php",
    "chars": 5352,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Provider;\n\nuse ReflectionClass;\nuse Laravel\\Lumen\\Application;\nuse Dingo\\Api\\Http\\FormRequest"
  },
  {
    "path": "src/Provider/RoutingServiceProvider.php",
    "chars": 1846,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Provider;\n\nuse Dingo\\Api\\Routing\\Router;\nuse Dingo\\Api\\Routing\\UrlGenerator;\nuse Dingo\\Api\\Co"
  },
  {
    "path": "src/Provider/ServiceProvider.php",
    "chars": 1713,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Provider;\n\nuse Illuminate\\Support\\ServiceProvider as IlluminateServiceProvider;\n\nabstract cla"
  },
  {
    "path": "src/Routing/Adapter/Laravel.php",
    "chars": 6087,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing\\Adapter;\n\nuse Dingo\\Api\\Contract\\Routing\\Adapter;\nuse Dingo\\Api\\Exception\\UnknownVers"
  },
  {
    "path": "src/Routing/Adapter/Lumen.php",
    "chars": 11535,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing\\Adapter;\n\nuse ArrayIterator;\nuse ReflectionClass;\nuse FastRoute\\Dispatcher;\nuse FastR"
  },
  {
    "path": "src/Routing/Helpers.php",
    "chars": 5146,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing;\n\nuse ErrorException;\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Dispatcher;\nuse Dingo\\Ap"
  },
  {
    "path": "src/Routing/ResourceRegistrar.php",
    "chars": 2012,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing;\n\nuse Illuminate\\Support\\Str;\nuse Illuminate\\Routing\\ResourceRegistrar as IlluminateR"
  },
  {
    "path": "src/Routing/Route.php",
    "chars": 13222,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing;\n\nuse Illuminate\\Support\\Arr;\nuse Illuminate\\Support\\Str;\nuse Illuminate\\Http\\Request"
  },
  {
    "path": "src/Routing/RouteCollection.php",
    "chars": 2232,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing;\n\nuse Countable;\nuse ArrayIterator;\nuse IteratorAggregate;\n\nclass RouteCollection imp"
  },
  {
    "path": "src/Routing/Router.php",
    "chars": 21351,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing;\n\nuse Closure;\nuse Dingo\\Api\\Contract\\Debug\\ExceptionHandler;\nuse Dingo\\Api\\Contract\\"
  },
  {
    "path": "src/Routing/UrlGenerator.php",
    "chars": 1025,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Routing;\n\nuse Illuminate\\Http\\Request;\nuse Illuminate\\Routing\\UrlGenerator as IlluminateUrlGe"
  },
  {
    "path": "src/Transformer/Adapter/Fractal.php",
    "chars": 6925,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Transformer\\Adapter;\n\nuse Dingo\\Api\\Http\\Request;\nuse Dingo\\Api\\Transformer\\Binding;\nuse Leag"
  },
  {
    "path": "src/Transformer/Binding.php",
    "chars": 2901,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Transformer;\n\nuse Closure;\nuse RuntimeException;\nuse Illuminate\\Container\\Container;\n\nclass B"
  },
  {
    "path": "src/Transformer/Factory.php",
    "chars": 6079,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Transformer;\n\nuse Closure;\nuse RuntimeException;\nuse Dingo\\Api\\Http\\Request;\nuse Illuminate\\S"
  },
  {
    "path": "src/helpers.php",
    "chars": 293,
    "preview": "<?php\n\nif (! function_exists('version')) {\n    /**\n     * Set the version to generate API URLs to.\n     *\n     * @param "
  },
  {
    "path": "tests/Auth/AuthTest.php",
    "chars": 4180,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Auth;\n\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Contract\\Auth\\Provider;\nuse Dingo\\Api\\Htt"
  },
  {
    "path": "tests/Auth/Provider/AuthorizationTest.php",
    "chars": 618,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Auth\\Provider;\n\nuse Dingo\\Api\\Routing\\Route;\nuse Dingo\\Api\\Tests\\BaseTestCase;\nuse Ding"
  },
  {
    "path": "tests/Auth/Provider/BasicTest.php",
    "chars": 1420,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Auth\\Provider;\n\nuse Dingo\\Api\\Auth\\Provider\\Basic;\nuse Dingo\\Api\\Routing\\Route;\nuse Din"
  },
  {
    "path": "tests/Auth/Provider/JWTTest.php",
    "chars": 2338,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Auth\\Provider;\n\nuse Dingo\\Api\\Auth\\Provider\\JWT;\nuse Dingo\\Api\\Routing\\Route;\nuse Dingo"
  },
  {
    "path": "tests/BaseTestCase.php",
    "chars": 495,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests;\n\nuse Dingo\\Api\\Http\\Response;\nuse Mockery;\nuse PHPUnit\\Framework\\TestCase;\n\nclass Base"
  },
  {
    "path": "tests/ChecksLaravelVersionTrait.php",
    "chars": 2412,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests;\n\nuse Dingo\\Api\\Tests\\Stubs\\ApplicationStub;\nuse Dingo\\Api\\Tests\\Stubs\\Application8Stub"
  },
  {
    "path": "tests/DispatcherTest.php",
    "chars": 14863,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests;\n\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Dispatcher;\nuse Dingo\\Api\\Exception\\Handler;\nu"
  },
  {
    "path": "tests/Exception/HandlerTest.php",
    "chars": 6835,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Exception;\n\nuse Dingo\\Api\\Exception\\Handler;\nuse Dingo\\Api\\Exception\\ResourceException;"
  },
  {
    "path": "tests/Http/Middleware/AuthTest.php",
    "chars": 3275,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Middleware;\n\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Http\\Middleware\\Auth as AuthMi"
  },
  {
    "path": "tests/Http/Middleware/RateLimitTest.php",
    "chars": 7933,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Middleware;\n\nuse Dingo\\Api\\Exception\\RateLimitExceededException;\nuse Dingo\\Api\\Htt"
  },
  {
    "path": "tests/Http/Middleware/RequestTest.php",
    "chars": 4330,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Middleware;\n\nuse Dingo\\Api\\Contract\\Http\\Request as RequestContract;\nuse Dingo\\Api"
  },
  {
    "path": "tests/Http/Parser/AcceptTest.php",
    "chars": 2604,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Parser;\n\nuse Dingo\\Api\\Http\\Parser\\Accept;\nuse Dingo\\Api\\Http\\Request;\nuse Dingo\\A"
  },
  {
    "path": "tests/Http/RateLimit/HandlerTest.php",
    "chars": 2686,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\RateLimit;\n\nuse Dingo\\Api\\Http\\RateLimit\\Handler;\nuse Dingo\\Api\\Http\\RateLimit\\Thr"
  },
  {
    "path": "tests/Http/RateLimit/Throttle/AuthenticatedTest.php",
    "chars": 581,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\RateLimit\\Throttle;\n\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Http\\RateLimit\\Throttl"
  },
  {
    "path": "tests/Http/RateLimit/Throttle/UnauthenticatedTest.php",
    "chars": 588,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\RateLimit\\Throttle;\n\nuse Dingo\\Api\\Auth\\Auth;\nuse Dingo\\Api\\Http\\RateLimit\\Throttl"
  },
  {
    "path": "tests/Http/RequestValidatorTest.php",
    "chars": 1498,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http;\n\nuse Dingo\\Api\\Http\\Parser\\Accept as AcceptParser;\nuse Dingo\\Api\\Http\\RequestVali"
  },
  {
    "path": "tests/Http/Response/FactoryTest.php",
    "chars": 7720,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Response;\n\nuse Closure;\nuse Dingo\\Api\\Http\\Response\\Factory;\nuse Dingo\\Api\\Tests\\B"
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJson/testMorphingArrayWithEightSpacesPrettyPrintIndent.json.php",
    "chars": 320,
    "preview": "<?php\n\n/*\n * Pretty printed JSON with 8 spaces indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\n{\n        \"foo\": \"bar\","
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJson/testMorphingArrayWithFourSpacesPrettyPrintIndent.json.php",
    "chars": 244,
    "preview": "<?php\n\n/*\n * Pretty printed JSON with 4 spaces indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\n{\n    \"foo\": \"bar\",\n   "
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJson/testMorphingArrayWithOneTabPrettyPrintIndent.json.php",
    "chars": 181,
    "preview": "<?php\n\n/*\n * Pretty printed with one tab indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\n{\n\t\"foo\": \"bar\",\n\t\"baz\": {\n\t\t"
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJson/testMorphingArrayWithTwoSpacesPrettyPrintIndent.json.php",
    "chars": 206,
    "preview": "<?php\n\n/*\n * Pretty printed JSON with 2 spaces indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\n{\n  \"foo\": \"bar\",\n  \"ba"
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJsonp/testMorphingArrayWithEightSpacesPrettyPrintIndent.jsonp.php",
    "chars": 326,
    "preview": "<?php\n\n/*\n * Pretty printed JSON with 8 spaces indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\nfoo({\n        \"foo\": \"b"
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJsonp/testMorphingArrayWithFourSpacesPrettyPrintIndent.jsonp.php",
    "chars": 251,
    "preview": "<?php\n\n/*\n * Pretty printed JSONP with 4 spaces indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\nfoo({\n    \"foo\": \"bar\""
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJsonp/testMorphingArrayWithOneTabPrettyPrintIndent.jsonp.php",
    "chars": 193,
    "preview": "<?php\n\n/*\n * Pretty printed JSONP with one tab indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\nfoo({\n\t\"foo\": \"bar\",\n\t\""
  },
  {
    "path": "tests/Http/Response/Format/ExpectedPrettyPrintedJsonp/testMorphingArrayWithTwoSpacesPrettyPrintIndent.jsonp.php",
    "chars": 213,
    "preview": "<?php\n\n/*\n * Pretty printed JSONP with 2 spaces indent\n *\n * @return string\n */\n\nreturn <<<'JSON'\nfoo({\n  \"foo\": \"bar\",\n"
  },
  {
    "path": "tests/Http/Response/Format/JsonTest.php",
    "chars": 5225,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Response\\Format;\n\nuse Dingo\\Api\\Http\\Response;\nuse Dingo\\Api\\Http\\Response\\Format\\"
  },
  {
    "path": "tests/Http/Response/Format/JsonpTest.php",
    "chars": 4653,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Response\\Format;\n\nuse Dingo\\Api\\Http\\Response;\nuse Dingo\\Api\\Http\\Response\\Format\\"
  },
  {
    "path": "tests/Http/ResponseTest.php",
    "chars": 2908,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http;\n\nuse Dingo\\Api\\Event\\ResponseIsMorphing;\nuse Dingo\\Api\\Event\\ResponseWasMorphed;\n"
  },
  {
    "path": "tests/Http/Validation/AcceptTest.php",
    "chars": 629,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Validation;\n\nuse Dingo\\Api\\Http\\Parser\\Accept as AcceptParser;\nuse Dingo\\Api\\Http\\"
  },
  {
    "path": "tests/Http/Validation/DomainTest.php",
    "chars": 2335,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Validation;\n\nuse Dingo\\Api\\Http\\Validation\\Domain;\nuse Dingo\\Api\\Tests\\BaseTestCas"
  },
  {
    "path": "tests/Http/Validation/PrefixTest.php",
    "chars": 1482,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Http\\Validation;\n\nuse Dingo\\Api\\Http\\Validation\\Prefix;\nuse Dingo\\Api\\Tests\\BaseTestCas"
  },
  {
    "path": "tests/Routing/Adapter/BaseAdapterTest.php",
    "chars": 8844,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Routing\\Adapter;\n\nuse Dingo\\Api\\Exception\\Handler;\nuse Dingo\\Api\\Http;\nuse Dingo\\Api\\Ro"
  },
  {
    "path": "tests/Routing/Adapter/LaravelTest.php",
    "chars": 451,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Routing\\Adapter;\n\nuse Dingo\\Api\\Routing\\Adapter\\Laravel;\nuse Illuminate\\Container\\Conta"
  },
  {
    "path": "tests/Routing/Adapter/LumenTest.php",
    "chars": 1397,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Routing\\Adapter;\n\nuse Dingo\\Api\\Routing\\Adapter\\Lumen;\nuse FastRoute\\DataGenerator\\Grou"
  },
  {
    "path": "tests/Routing/RouteTest.php",
    "chars": 4509,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Routing;\n\nuse Dingo\\Api\\Http\\Request;\nuse Dingo\\Api\\Routing\\Route;\nuse Dingo\\Api\\Tests\\"
  },
  {
    "path": "tests/Routing/RouterTest.php",
    "chars": 13876,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Routing;\n\nuse Dingo\\Api\\Http;\nuse Dingo\\Api\\Routing\\Route;\nuse Dingo\\Api\\Routing\\Router"
  },
  {
    "path": "tests/Stubs/Application58Stub.php",
    "chars": 2832,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Closure;\nuse Illuminate\\Container\\Container;\nuse Illuminate\\Contracts\\Found"
  },
  {
    "path": "tests/Stubs/Application6Stub.php",
    "chars": 2841,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Closure;\nuse Illuminate\\Container\\Container;\nuse Illuminate\\Contracts\\Found"
  },
  {
    "path": "tests/Stubs/Application7Stub.php",
    "chars": 2829,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Illuminate\\Container\\Container;\nuse Illuminate\\Contracts\\Foundation\\Applica"
  },
  {
    "path": "tests/Stubs/Application8Stub.php",
    "chars": 2829,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Illuminate\\Container\\Container;\nuse Illuminate\\Contracts\\Foundation\\Applica"
  },
  {
    "path": "tests/Stubs/ApplicationStub.php",
    "chars": 1277,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Illuminate\\Container\\Container;\nuse Illuminate\\Contracts\\Foundation\\Applica"
  },
  {
    "path": "tests/Stubs/AuthorizationProviderStub.php",
    "chars": 412,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Dingo\\Api\\Auth\\Provider\\Authorization;\nuse Dingo\\Api\\Routing\\Route;\nuse Ill"
  },
  {
    "path": "tests/Stubs/BasicThrottleStub.php",
    "chars": 377,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Dingo\\Api\\Contract\\Http\\RateLimit\\Throttle;\nuse Illuminate\\Container\\Contai"
  },
  {
    "path": "tests/Stubs/EloquentModelStub.php",
    "chars": 234,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Illuminate\\Database\\Eloquent\\Model;\n\nclass EloquentModelStub extends Model\n"
  },
  {
    "path": "tests/Stubs/HttpValidatorStub.php",
    "chars": 267,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Dingo\\Api\\Contract\\Http\\Validator;\nuse Illuminate\\Http\\Request;\n\nclass Http"
  },
  {
    "path": "tests/Stubs/MiddlewareStub.php",
    "chars": 176,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Closure;\n\nclass MiddlewareStub\n{\n    public function handle($request, Closu"
  },
  {
    "path": "tests/Stubs/RoutingAdapterStub.php",
    "chars": 3450,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Closure;\nuse Dingo\\Api\\Contract\\Routing\\Adapter;\nuse Dingo\\Api\\Http\\Respons"
  },
  {
    "path": "tests/Stubs/RoutingControllerOtherStub.php",
    "chars": 194,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Illuminate\\Routing\\Controller;\n\nclass RoutingControllerOtherStub extends Co"
  },
  {
    "path": "tests/Stubs/RoutingControllerStub.php",
    "chars": 659,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Dingo\\Api\\Routing\\Helpers;\nuse Illuminate\\Routing\\Controller;\n\nclass Routin"
  },
  {
    "path": "tests/Stubs/ThrottleStub.php",
    "chars": 464,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Dingo\\Api\\Http\\RateLimit\\Throttle\\Throttle;\nuse Illuminate\\Container\\Contai"
  },
  {
    "path": "tests/Stubs/TransformerStub.php",
    "chars": 609,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nuse Dingo\\Api\\Contract\\Transformer\\Adapter;\nuse Dingo\\Api\\Http\\Request;\nuse Din"
  },
  {
    "path": "tests/Stubs/UserStub.php",
    "chars": 159,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nclass UserStub\n{\n    public $name;\n\n    public function __construct($name)\n    "
  },
  {
    "path": "tests/Stubs/UserTransformerStub.php",
    "chars": 192,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Stubs;\n\nclass UserTransformerStub\n{\n    public function transform(UserStub $user)\n    {"
  },
  {
    "path": "tests/Transformer/Adapter/FractalTest.php",
    "chars": 1050,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Transformer\\Adapter;\n\nuse Dingo\\Api\\Http\\Request;\nuse Dingo\\Api\\Tests\\BaseTestCase;\nuse"
  },
  {
    "path": "tests/Transformer/FactoryTest.php",
    "chars": 3692,
    "preview": "<?php\n\nnamespace Dingo\\Api\\Tests\\Transformer;\n\nuse Dingo\\Api\\Tests\\BaseTestCase;\nuse Dingo\\Api\\Tests\\Stubs\\TransformerSt"
  }
]

About this extraction

This page contains the full source code of the dingo/api GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 140 files (390.2 KB), approximately 96.1k tokens, and a symbol index with 1010 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!