diff --git a/README.md b/README.md index ca50a5e..e4f77f0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A simple package that allows you to write your API integrations or SDKs in a ele ## Installation & Usage -This package requires PHP >= 7.2.5. You'll find installation instructions and full documentation on https://jenky.github.io/atlas. +This package requires PHP >= 7.2.5. You'll find installation instructions and full documentation on https://phanxipang.github.io/fansipan. ## Testing @@ -40,20 +40,14 @@ If you discover any security related issues, please email contact@lynh.me instea The MIT License (MIT). Please see [License File](LICENSE.md) for more information. -[ico-version]: https://img.shields.io/packagist/v/jenky/atlas.svg?style=for-the-badge +[ico-version]: https://img.shields.io/packagist/v/fansipan/fansipan.svg?style=for-the-badge [ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=for-the-badge -[ico-travis]: https://img.shields.io/travis/jenky/atlas/master.svg?style=for-the-badge -[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/jenky/atlas.svg?style=for-the-badge -[ico-code-quality]: https://img.shields.io/scrutinizer/g/jenky/atlas.svg?style=for-the-badge -[ico-gh-actions]: https://img.shields.io/github/actions/workflow/status/jenky/atlas/testing.yml?branch=main&label=actions&logo=github&style=for-the-badge -[ico-codecov]: https://img.shields.io/codecov/c/github/jenky/atlas?logo=codecov&style=for-the-badge -[ico-downloads]: https://img.shields.io/packagist/dt/jenky/atlas.svg?style=for-the-badge - -[link-packagist]: https://packagist.org/packages/jenky/atlas -[link-travis]: https://travis-ci.org/jenky/atlas -[link-scrutinizer]: https://scrutinizer-ci.com/g/jenky/atlas/code-structure -[link-code-quality]: https://scrutinizer-ci.com/g/jenky/atlas -[link-gh-actions]: https://github.com/jenky/atlas/actions -[link-codecov]: https://codecov.io/gh/jenky/atlas -[link-downloads]: https://packagist.org/packages/jenky/atlas +[ico-gh-actions]: https://img.shields.io/github/actions/workflow/status/phanxipang/fansipan/testing.yml?branch=main&label=actions&logo=github&style=for-the-badge +[ico-codecov]: https://img.shields.io/codecov/c/github/phanxipang/fansipan?logo=codecov&style=for-the-badge +[ico-downloads]: https://img.shields.io/packagist/dt/fansipan/fansipan.svg?style=for-the-badge + +[link-packagist]: https://packagist.org/packages/fansipan/fansipan +[link-gh-actions]: https://github.com/phanxipang/fansipan/actions +[link-codecov]: https://codecov.io/gh/phanxipang/fansipan +[link-downloads]: https://packagist.org/packages/fansipan/fansipan diff --git a/composer.json b/composer.json index 7971f92..8def2f8 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,7 @@ { - "name": "jenky/atlas", + "name": "fansipan/fansipan", "description": "A simple package that allows you to write your API integrations or SDKs in a elegant way.", "keywords": [ - "jenky", - "atlas", "http", "sdk", "api", @@ -11,7 +9,7 @@ "psr17", "psr18" ], - "homepage": "https://github.com/jenky/atlas", + "homepage": "https://github.com/phanxipang/fansipan", "license": "MIT", "authors": [ { @@ -39,7 +37,7 @@ }, "autoload": { "psr-4": { - "Jenky\\Atlas\\": "src" + "Fansipan\\": "src" }, "classmap": [ "stubs" @@ -47,7 +45,7 @@ }, "autoload-dev": { "psr-4": { - "Jenky\\Atlas\\Tests\\": "tests" + "Fansipan\\Tests\\": "tests" } }, "scripts": { diff --git a/docs/advanced/middleware.md b/docs/advanced/middleware.md index 0ff863e..f513cae 100644 --- a/docs/advanced/middleware.md +++ b/docs/advanced/middleware.md @@ -94,8 +94,8 @@ final class AfterMiddleware To register default middleware, list the middleware class in the `defaultMiddleware` method of your connector class. ```php -use Jenky\Atlas\Contracts\ConnectorInterface; -use Jenky\Atlas\Traits\ConnectorTrait; +use Fansipan\Contracts\ConnectorInterface; +use Fansipan\Traits\ConnectorTrait; final class Connector implements ConnectorInterface { @@ -118,10 +118,10 @@ Once the middleware has been created, you may use the `push` method to assign mi $connector->middleware()->push(new AddHeader('X-Foo', 'baz')); ``` -Creating a middleware that modifies a request is made much simpler using the `Jenky\Atlas\Middleware\Interceptor::request()` method. This middleware accepts a function that takes the request argument: +Creating a middleware that modifies a request is made much simpler using the `Fansipan\Middleware\Interceptor::request()` method. This middleware accepts a function that takes the request argument: ```php -use Jenky\Atlas\Middleware\Interceptor; +use Fansipan\Middleware\Interceptor; use Psr\Http\Message\RequestInterface; $connector->middleware()->push(Interceptor::request(function (RequestInterface $request) { @@ -129,10 +129,10 @@ $connector->middleware()->push(Interceptor::request(function (RequestInterface $ })); ``` -Modifying a response is also much simpler using the `Jenky\Atlas\Middleware\Interceptor::response()` middleware: +Modifying a response is also much simpler using the `Fansipan\Middleware\Interceptor::response()` middleware: ```php -use Jenky\Atlas\Middleware\Interceptor; +use Fansipan\Middleware\Interceptor; use Psr\Http\Message\ResponseInterface; $connector->middleware()->push(Interceptor::response(function (ResponseInterface $response) { diff --git a/docs/advanced/response-decoder.md b/docs/advanced/response-decoder.md index cb287b7..ec0dd81 100644 --- a/docs/advanced/response-decoder.md +++ b/docs/advanced/response-decoder.md @@ -6,15 +6,15 @@ HTTP response is a crucial aspect of web development, and it is essential to dec ### Configuring -The decoder should be configured as per-request basis. By default `Jenky\Atlas\Request` uses [`ChainDecoder`](https://github.com/jenky/atlas/blob/18f96c176bed75fa321df6a675146820760e295f/src/Request.php#L124-L130) to decode the response body. Essentially, it iterates over a list of `JsonDecoder` and `XmlDecoder` and attempts to read the `Content Type` header to determine which one to use for decoding the body. +The decoder should be configured as per-request basis. By default `Fansipan\Request` uses [`ChainDecoder`](https://github.com/jenky/atlas/blob/18f96c176bed75fa321df6a675146820760e295f/src/Request.php#L124-L130) to decode the response body. Essentially, it iterates over a list of `JsonDecoder` and `XmlDecoder` and attempts to read the `Content Type` header to determine which one to use for decoding the body. ### Creating Custom Decoder To create a custom decoder, you need to implement [`DecoderInterface`](https://github.com/jenky/atlas/blob/main/src/Contracts/DecoderInterface.php) which defines the structure that a decoder must have. The contract contains only one method: `decode` where you can implement your own logic to decode the response body. Then you can start using it in your request. ```php -use Jenky\Atlas\Contracts\DecoderInterface; -use Jenky\Atlas\Request; +use Fansipan\Contracts\DecoderInterface; +use Fansipan\Request; class MyRequest extends Request { diff --git a/docs/advanced/retrying-requests.md b/docs/advanced/retrying-requests.md index d5ea039..765c54f 100644 --- a/docs/advanced/retrying-requests.md +++ b/docs/advanced/retrying-requests.md @@ -6,10 +6,10 @@ Sometimes you may deal with APIs that fail frequently because of network issues ## Getting Started -To retry a failed request, you should use the `Jenky\Atlas\ConnectorConfigurator` to configure your connector for retrying the request. The `retry` method accepts the maximum number of times the request should be attempted, a retry strategy to decide if the request should be retried, and to define the waiting time between each retry. +To retry a failed request, you should use the `Fansipan\ConnectorConfigurator` to configure your connector for retrying the request. The `retry` method accepts the maximum number of times the request should be attempted, a retry strategy to decide if the request should be retried, and to define the waiting time between each retry. ```php -use Jenky\Atlas\ConnectorConfigurator; +use Fansipan\ConnectorConfigurator; $connector = new MyConnector(); $response = (new ConnectorConfigurator()) @@ -29,11 +29,11 @@ $response = (new ConnectorConfigurator()) By default, failed requests are retried up to 3 times, with an exponential delay between retries (first retry = 1 second; second retry: 2 seconds, third retry: 4 seconds) and only for the following HTTP status codes: `423`, `425`, `429`, `502` and `503` when using any HTTP method and `500`, `504`, `507` and `510` when using an HTTP [idempotent method](https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods). -If needed, you may pass a third argument to the `Jenky\Atlas\RetryableConnector` instance. It is an instance of `Jenky\Atlas\Contracts\RetryStrategyInterface` that determines if the retries should actually be attempted. This will retries the failed requests with a delay of 1 second. +If needed, you may pass a third argument to the `Fansipan\RetryableConnector` instance. It is an instance of `Fansipan\Contracts\RetryStrategyInterface` that determines if the retries should actually be attempted. This will retries the failed requests with a delay of 1 second. ```php -use Jenky\Atlas\ConnectorConfigurator; -use Jenky\Atlas\Retry\RetryCallback; +use Fansipan\ConnectorConfigurator; +use Fansipan\Retry\RetryCallback; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -50,8 +50,8 @@ $response = (new ConnectorConfigurator()) You may also pass second and third arguments to the `RetryCallback::when()` method to customise the waiting time between each retry. ```php -use Jenky\Atlas\ConnectorConfigurator; -use Jenky\Atlas\Retry\RetryCallback; +use Fansipan\ConnectorConfigurator; +use Fansipan\Retry\RetryCallback; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -68,9 +68,9 @@ In the example above, failed requests are retried up to 3 times, with an exponen Instead of using an interval delay or calculated exponential delay, you may easily configure "exponential" backoffs by using `withDelay()` method. In this example, the retry delay will be 1 second for the first retry, 3 seconds for the second retry, and 10 seconds for the third retry: ```php -use Jenky\Atlas\ConnectorConfigurator; -use Jenky\Atlas\Retry\Backoff; -use Jenky\Atlas\Retry\RetryCallback; +use Fansipan\ConnectorConfigurator; +use Fansipan\Retry\Backoff; +use Fansipan\Retry\RetryCallback; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -84,13 +84,13 @@ $response = (new ConnectorConfigurator()) ## Disabling Throwing Exceptions -If a request fails, it will be attempted again - if it reaches the maximum number of errors, a `Jenky\Atlas\Exception\RequestRetryFailedException` will be thrown. If a request is successful at any point, it will return a `Jenky\Atlas\Response` instance. +If a request fails, it will be attempted again - if it reaches the maximum number of errors, a `Fansipan\Exception\RequestRetryFailedException` will be thrown. If a request is successful at any point, it will return a `Fansipan\Response` instance. If you would like to disable this behavior, you may provide a `throw` argument with a value of `false`. When disabled, the last response received by the client will be returned after all retries have been attempted: ```php -use Jenky\Atlas\ConnectorConfigurator; +use Fansipan\ConnectorConfigurator; $response = (new ConnectorConfigurator()) ->retry(2, null, throw: false) @@ -106,8 +106,8 @@ Since middleware is mutable, adding new middleware means that all subsequent req ```php with('image', MultipartResource::from(__DIR__.'/../path_to_image.jpg', ``` !!! -You can create your own multipart file to fit your application logic. It must implement the `Jenky\Atlas\Contracts\MultipartInterface`. +You can create your own multipart file to fit your application logic. It must implement the `Fansipan\Contracts\MultipartInterface`. !!! ### Raw requests @@ -174,8 +174,8 @@ You may use the `AsText` trait if you would like to provide a raw request body w ```php body(): string; diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index 00d4824..a9b4368 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -5,7 +5,7 @@ order: 90 You can install the package via composer: ```bash -composer require jenky/atlas +composer require fansipan/fansipan ``` You should have at least one package that offers implementation for [PSR-7, PSR-17 and PSR-18](./requirements.md). Here are a few recommendations: diff --git a/docs/getting-started/quickstart.md b/docs/getting-started/quickstart.md index 5ad6408..666cc40 100644 --- a/docs/getting-started/quickstart.md +++ b/docs/getting-started/quickstart.md @@ -8,15 +8,15 @@ First, you should [install the package](./installation.md). ## Create a Connector -In order to send a request. You should create a `Connector` class that implements `Jenky\Atlas\Contracts\ConnectorInterface` interface and add `Jenky\Atlas\Traits\ConnectorTrait` trait to the connector to fullfil the contract interface. +In order to send a request. You should create a `Connector` class that implements `Fansipan\Contracts\ConnectorInterface` interface and add `Fansipan\Traits\ConnectorTrait` trait to the connector to fullfil the contract interface. Additionally, you can set the request base URI by utilizing the `baseUri` static method. If a relative URI is specified in the request `endpoint` method, the connector will merge the base URI with the relative URI, following the guidelines outlined in [RFC 3986, section 5.2](https://www.rfc-editor.org/rfc/rfc3986#section-5.2). ```php send($request); ## Inspecting response -The request above will return an instance of `Jenky\Atlas\Response`, which provides a variety of methods that may be used to inspect the response: +The request above will return an instance of `Fansipan\Response`, which provides a variety of methods that may be used to inspect the response: ```php if ($response->failed()) { diff --git a/docs/retype.yml b/docs/retype.yml index 7f70af0..d151176 100644 --- a/docs/retype.yml +++ b/docs/retype.yml @@ -1,13 +1,13 @@ input: . output: .retype -url: jenky.github.io/atlas +url: phanxipang.github.io/fansipan branding: - title: Atlas + title: Fansipan label: beta edit: - repo: https://github.com/jenky/atlas + repo: https://github.com/phanxipan/fansipan base: /docs links: @@ -16,7 +16,7 @@ links: icon: home - text: Github - link: https://github.com/jenky/atlas + link: https://github.com/phanxipan/fansipan icon: mark-github target: blank diff --git a/docs/static/sdk-hero.png b/docs/static/sdk-hero.png index b685d22..bc8f039 100644 Binary files a/docs/static/sdk-hero.png and b/docs/static/sdk-hero.png differ diff --git a/src/Body/AsJson.php b/src/Body/AsJson.php index 35469ef..de0b058 100644 --- a/src/Body/AsJson.php +++ b/src/Body/AsJson.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; -use Jenky\Atlas\Contracts\PayloadInterface; +use Fansipan\Contracts\PayloadInterface; trait AsJson { diff --git a/src/Body/AsMultipart.php b/src/Body/AsMultipart.php index 87ffa25..a5695d4 100644 --- a/src/Body/AsMultipart.php +++ b/src/Body/AsMultipart.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; -use Jenky\Atlas\Contracts\PayloadInterface; +use Fansipan\Contracts\PayloadInterface; trait AsMultipart { diff --git a/src/Body/AsText.php b/src/Body/AsText.php index 454ea12..16331f4 100644 --- a/src/Body/AsText.php +++ b/src/Body/AsText.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; -use Jenky\Atlas\Contracts\PayloadInterface; +use Fansipan\Contracts\PayloadInterface; trait AsText { diff --git a/src/Body/FormPayload.php b/src/Body/FormPayload.php index 24966e5..80d0616 100644 --- a/src/Body/FormPayload.php +++ b/src/Body/FormPayload.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; -use Jenky\Atlas\Contracts\PayloadInterface; -use Jenky\Atlas\Map; +use Fansipan\Contracts\PayloadInterface; +use Fansipan\Map; final class FormPayload extends Map implements PayloadInterface { diff --git a/src/Body/JsonPayload.php b/src/Body/JsonPayload.php index bc462ea..877e2ee 100644 --- a/src/Body/JsonPayload.php +++ b/src/Body/JsonPayload.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; -use Jenky\Atlas\Contracts\PayloadInterface; -use Jenky\Atlas\Map; +use Fansipan\Contracts\PayloadInterface; +use Fansipan\Map; final class JsonPayload extends Map implements PayloadInterface { diff --git a/src/Body/MultipartPayload.php b/src/Body/MultipartPayload.php index d2ace4d..738e2a5 100644 --- a/src/Body/MultipartPayload.php +++ b/src/Body/MultipartPayload.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; +use Fansipan\Contracts\MultipartInterface; +use Fansipan\Contracts\PayloadInterface; +use Fansipan\Map; use Http\Discovery\Psr17FactoryDiscovery; -use Jenky\Atlas\Contracts\MultipartInterface; -use Jenky\Atlas\Contracts\PayloadInterface; -use Jenky\Atlas\Map; use Psr\Http\Message\StreamInterface; final class MultipartPayload extends Map implements PayloadInterface diff --git a/src/Body/MultipartResource.php b/src/Body/MultipartResource.php index f4edf18..2965425 100644 --- a/src/Body/MultipartResource.php +++ b/src/Body/MultipartResource.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; +use Fansipan\Contracts\MultipartInterface; use GuzzleHttp\Psr7\MimeType; use Http\Discovery\Psr17FactoryDiscovery; -use Jenky\Atlas\Contracts\MultipartInterface; use Psr\Http\Message\StreamInterface; use Psr\Http\Message\UploadedFileInterface; use Symfony\Component\Mime\MimeTypes; diff --git a/src/Body/RawPayload.php b/src/Body/RawPayload.php index 0207562..3c66185 100644 --- a/src/Body/RawPayload.php +++ b/src/Body/RawPayload.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Jenky\Atlas\Body; +namespace Fansipan\Body; -use Jenky\Atlas\Contracts\PayloadInterface; +use Fansipan\Contracts\PayloadInterface; use LogicException; final class RawPayload implements PayloadInterface diff --git a/src/ConnectorConfigurator.php b/src/ConnectorConfigurator.php index 637bb28..baaa839 100644 --- a/src/ConnectorConfigurator.php +++ b/src/ConnectorConfigurator.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace Jenky\Atlas; +namespace Fansipan; -use Jenky\Atlas\Contracts\ConnectorInterface; -use Jenky\Atlas\Contracts\RetryStrategyInterface; -use Jenky\Atlas\Middleware\FollowRedirects; -use Jenky\Atlas\Middleware\RetryRequests; -use Jenky\Atlas\Retry\Delay; -use Jenky\Atlas\Retry\GenericRetryStrategy; +use Fansipan\Contracts\ConnectorInterface; +use Fansipan\Contracts\RetryStrategyInterface; +use Fansipan\Middleware\FollowRedirects; +use Fansipan\Middleware\RetryRequests; +use Fansipan\Retry\Delay; +use Fansipan\Retry\GenericRetryStrategy; class ConnectorConfigurator { diff --git a/src/ConnectorlessRequest.php b/src/ConnectorlessRequest.php index 9d07ce7..76f4c9b 100644 --- a/src/ConnectorlessRequest.php +++ b/src/ConnectorlessRequest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas; +namespace Fansipan; abstract class ConnectorlessRequest extends Request { diff --git a/src/Contracts/ConnectorInterface.php b/src/Contracts/ConnectorInterface.php index 4e1c954..9844dba 100644 --- a/src/Contracts/ConnectorInterface.php +++ b/src/Contracts/ConnectorInterface.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Jenky\Atlas\Contracts; +namespace Fansipan\Contracts; -use Jenky\Atlas\Middleware; -use Jenky\Atlas\Request; -use Jenky\Atlas\Response; +use Fansipan\Middleware; +use Fansipan\Request; +use Fansipan\Response; use Psr\Http\Client\ClientInterface; interface ConnectorInterface diff --git a/src/Contracts/DecoderInterface.php b/src/Contracts/DecoderInterface.php index a4923ec..2c6bf07 100644 --- a/src/Contracts/DecoderInterface.php +++ b/src/Contracts/DecoderInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Contracts; +namespace Fansipan\Contracts; use Psr\Http\Message\ResponseInterface; @@ -11,7 +11,7 @@ interface DecoderInterface /** * Decode response body to native array type. * - * @throws \Jenky\Atlas\Exception\NotDecodableException if decoder is unable to decode the response + * @throws \Fansipan\Exception\NotDecodableException if decoder is unable to decode the response */ public function decode(ResponseInterface $response): array; } diff --git a/src/Contracts/DelayStrategyInterface.php b/src/Contracts/DelayStrategyInterface.php index 54d20ad..051d741 100644 --- a/src/Contracts/DelayStrategyInterface.php +++ b/src/Contracts/DelayStrategyInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Contracts; +namespace Fansipan\Contracts; interface DelayStrategyInterface { diff --git a/src/Contracts/MultipartInterface.php b/src/Contracts/MultipartInterface.php index 67fa3c6..742daa8 100644 --- a/src/Contracts/MultipartInterface.php +++ b/src/Contracts/MultipartInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Contracts; +namespace Fansipan\Contracts; use Psr\Http\Message\StreamInterface; diff --git a/src/Contracts/PayloadInterface.php b/src/Contracts/PayloadInterface.php index 14e48d3..ff14504 100644 --- a/src/Contracts/PayloadInterface.php +++ b/src/Contracts/PayloadInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Contracts; +namespace Fansipan\Contracts; interface PayloadInterface extends \Stringable { diff --git a/src/Contracts/PipelineInterface.php b/src/Contracts/PipelineInterface.php index 287c722..eea6ac4 100644 --- a/src/Contracts/PipelineInterface.php +++ b/src/Contracts/PipelineInterface.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Contracts; +namespace Fansipan\Contracts; use Closure; diff --git a/src/Contracts/RetryStrategyInterface.php b/src/Contracts/RetryStrategyInterface.php index 0810925..b824d1b 100644 --- a/src/Contracts/RetryStrategyInterface.php +++ b/src/Contracts/RetryStrategyInterface.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Jenky\Atlas\Contracts; +namespace Fansipan\Contracts; -use Jenky\Atlas\Retry\RetryContext; +use Fansipan\Retry\RetryContext; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; diff --git a/src/Decoder/ChainDecoder.php b/src/Decoder/ChainDecoder.php index 5b6226b..c960661 100644 --- a/src/Decoder/ChainDecoder.php +++ b/src/Decoder/ChainDecoder.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Jenky\Atlas\Decoder; +namespace Fansipan\Decoder; -use Jenky\Atlas\Contracts\DecoderInterface; -use Jenky\Atlas\Exception\NotDecodableException; +use Fansipan\Contracts\DecoderInterface; +use Fansipan\Exception\NotDecodableException; use Psr\Http\Message\ResponseInterface; final class ChainDecoder implements DecoderInterface @@ -24,7 +24,7 @@ public function __construct(iterable $decoders) } /** - * @throws \Jenky\Atlas\Exception\NotDecodableException + * @throws \Fansipan\Exception\NotDecodableException */ public function decode(ResponseInterface $response): array { diff --git a/src/Decoder/JsonDecoder.php b/src/Decoder/JsonDecoder.php index 0d2518c..dfe906f 100644 --- a/src/Decoder/JsonDecoder.php +++ b/src/Decoder/JsonDecoder.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Jenky\Atlas\Decoder; +namespace Fansipan\Decoder; -use Jenky\Atlas\Contracts\DecoderInterface; -use Jenky\Atlas\Exception\NotDecodableException; +use Fansipan\Contracts\DecoderInterface; +use Fansipan\Exception\NotDecodableException; use Psr\Http\Message\ResponseInterface; final class JsonDecoder implements DecoderInterface { /** - * @throws \Jenky\Atlas\Exception\NotDecodableException + * @throws \Fansipan\Exception\NotDecodableException */ public function decode(ResponseInterface $response): array { diff --git a/src/Decoder/XmlDecoder.php b/src/Decoder/XmlDecoder.php index 32eb8cc..a981bec 100644 --- a/src/Decoder/XmlDecoder.php +++ b/src/Decoder/XmlDecoder.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Jenky\Atlas\Decoder; +namespace Fansipan\Decoder; -use Jenky\Atlas\Contracts\DecoderInterface; -use Jenky\Atlas\Exception\NotDecodableException; +use Fansipan\Contracts\DecoderInterface; +use Fansipan\Exception\NotDecodableException; use Psr\Http\Message\ResponseInterface; final class XmlDecoder implements DecoderInterface { /** - * @throws \Jenky\Atlas\Exception\NotDecodableException + * @throws \Fansipan\Exception\NotDecodableException */ public function decode(ResponseInterface $response): array { diff --git a/src/Exception/ClientRequestException.php b/src/Exception/ClientRequestException.php index 1ecba8b..de9f105 100644 --- a/src/Exception/ClientRequestException.php +++ b/src/Exception/ClientRequestException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; class ClientRequestException extends HttpException { diff --git a/src/Exception/HttpException.php b/src/Exception/HttpException.php index a93a26a..47cfd8c 100644 --- a/src/Exception/HttpException.php +++ b/src/Exception/HttpException.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; -use Jenky\Atlas\Response; +use Fansipan\Response; class HttpException extends ResponseAwareException { diff --git a/src/Exception/NetworkException.php b/src/Exception/NetworkException.php index 49249a6..6a6d2ac 100644 --- a/src/Exception/NetworkException.php +++ b/src/Exception/NetworkException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; use Psr\Http\Client\NetworkExceptionInterface; use Psr\Http\Message\RequestInterface; diff --git a/src/Exception/NotDecodableException.php b/src/Exception/NotDecodableException.php index 3feeae0..75d5e7c 100644 --- a/src/Exception/NotDecodableException.php +++ b/src/Exception/NotDecodableException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; use Psr\Http\Client\ClientExceptionInterface; diff --git a/src/Exception/RequestException.php b/src/Exception/RequestException.php index f0f8a2b..7ea0e40 100644 --- a/src/Exception/RequestException.php +++ b/src/Exception/RequestException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; use Psr\Http\Client\RequestExceptionInterface; use Psr\Http\Message\RequestInterface; diff --git a/src/Exception/RequestRetryFailedException.php b/src/Exception/RequestRetryFailedException.php index 07d3d05..99310ca 100644 --- a/src/Exception/RequestRetryFailedException.php +++ b/src/Exception/RequestRetryFailedException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; class RequestRetryFailedException extends RequestException { diff --git a/src/Exception/ResponseAwareException.php b/src/Exception/ResponseAwareException.php index 34de9aa..84a1dfc 100644 --- a/src/Exception/ResponseAwareException.php +++ b/src/Exception/ResponseAwareException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Message\ResponseInterface; diff --git a/src/Exception/ServerRequestException.php b/src/Exception/ServerRequestException.php index 0692d70..7049a43 100644 --- a/src/Exception/ServerRequestException.php +++ b/src/Exception/ServerRequestException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; class ServerRequestException extends HttpException { diff --git a/src/Exception/TooManyRedirectsException.php b/src/Exception/TooManyRedirectsException.php index c80146c..db73394 100644 --- a/src/Exception/TooManyRedirectsException.php +++ b/src/Exception/TooManyRedirectsException.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Exception; +namespace Fansipan\Exception; class TooManyRedirectsException extends RequestException { diff --git a/src/GenericConnector.php b/src/GenericConnector.php index 002e8f3..30ce09a 100644 --- a/src/GenericConnector.php +++ b/src/GenericConnector.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Jenky\Atlas; +namespace Fansipan; -use Jenky\Atlas\Contracts\ConnectorInterface; -use Jenky\Atlas\Traits\ConnectorTrait; +use Fansipan\Contracts\ConnectorInterface; +use Fansipan\Traits\ConnectorTrait; final class GenericConnector implements ConnectorInterface { diff --git a/src/Map.php b/src/Map.php index 531e968..5dec48c 100644 --- a/src/Map.php +++ b/src/Map.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas; +namespace Fansipan; class Map implements \ArrayAccess, \IteratorAggregate, \Countable { diff --git a/src/Middleware.php b/src/Middleware.php index b58f406..ae5a4ff 100644 --- a/src/Middleware.php +++ b/src/Middleware.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas; +namespace Fansipan; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; diff --git a/src/Middleware/Auth/AuthenticationMiddlewareTrait.php b/src/Middleware/Auth/AuthenticationMiddlewareTrait.php index 3b94d4a..4a9d5aa 100644 --- a/src/Middleware/Auth/AuthenticationMiddlewareTrait.php +++ b/src/Middleware/Auth/AuthenticationMiddlewareTrait.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Middleware\Auth; +namespace Fansipan\Middleware\Auth; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; diff --git a/src/Middleware/Auth/BasicAuthentication.php b/src/Middleware/Auth/BasicAuthentication.php index 7aaaf66..d6a8380 100644 --- a/src/Middleware/Auth/BasicAuthentication.php +++ b/src/Middleware/Auth/BasicAuthentication.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Middleware\Auth; +namespace Fansipan\Middleware\Auth; final class BasicAuthentication { diff --git a/src/Middleware/Auth/BearerAuthentication.php b/src/Middleware/Auth/BearerAuthentication.php index 5539bb2..aac75eb 100644 --- a/src/Middleware/Auth/BearerAuthentication.php +++ b/src/Middleware/Auth/BearerAuthentication.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Middleware\Auth; +namespace Fansipan\Middleware\Auth; final class BearerAuthentication { diff --git a/src/Middleware/FollowRedirects.php b/src/Middleware/FollowRedirects.php index a4e1fef..744225c 100644 --- a/src/Middleware/FollowRedirects.php +++ b/src/Middleware/FollowRedirects.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Jenky\Atlas\Middleware; +namespace Fansipan\Middleware; -use Jenky\Atlas\Exception\TooManyRedirectsException; -use Jenky\Atlas\Util; +use Fansipan\Exception\TooManyRedirectsException; +use Fansipan\Util; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\UriInterface; diff --git a/src/Middleware/Interceptor.php b/src/Middleware/Interceptor.php index 7f2c3c2..e0af739 100644 --- a/src/Middleware/Interceptor.php +++ b/src/Middleware/Interceptor.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Middleware; +namespace Fansipan\Middleware; use Closure; use Psr\Http\Message\RequestInterface; diff --git a/src/Middleware/RetryRequests.php b/src/Middleware/RetryRequests.php index c62c7cb..a5dfbe7 100644 --- a/src/Middleware/RetryRequests.php +++ b/src/Middleware/RetryRequests.php @@ -2,23 +2,23 @@ declare(strict_types=1); -namespace Jenky\Atlas\Middleware; +namespace Fansipan\Middleware; -use Jenky\Atlas\Contracts\RetryStrategyInterface; -use Jenky\Atlas\Exception\RequestRetryFailedException; -use Jenky\Atlas\Retry\RetryContext; +use Fansipan\Contracts\RetryStrategyInterface; +use Fansipan\Exception\RequestRetryFailedException; +use Fansipan\Retry\RetryContext; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; final class RetryRequests { /** - * @var \Jenky\Atlas\Retry\RetryContext + * @var \Fansipan\Retry\RetryContext */ private $context; /** - * @var \Jenky\Atlas\Contracts\RetryStrategyInterface + * @var \Fansipan\Contracts\RetryStrategyInterface */ private $strategy; @@ -29,7 +29,7 @@ public function __construct(RetryStrategyInterface $strategy, int $maxRetries = } /** - * @throws \Jenky\Atlas\Exception\RequestRetryFailedException + * @throws \Fansipan\Exception\RequestRetryFailedException */ public function __invoke(RequestInterface $request, callable $next): ResponseInterface { diff --git a/src/Pipeline.php b/src/Pipeline.php index b8d08c3..6ee7cde 100644 --- a/src/Pipeline.php +++ b/src/Pipeline.php @@ -1,9 +1,9 @@ * - * @throws \Jenky\Atlas\Exception\NotDecodableException + * @throws \Fansipan\Exception\NotDecodableException */ private function decode(): array { @@ -212,7 +212,7 @@ public function toException(): ?HttpException /** * Throw an exception if a server or client error occurred. * - * @throws \Jenky\Atlas\Exception\HttpException + * @throws \Fansipan\Exception\HttpException */ public function throw(): self { @@ -236,7 +236,7 @@ public function throw(): self * * @param \Closure|bool $condition * - * @throws \Jenky\Atlas\Exception\HttpException + * @throws \Fansipan\Exception\HttpException */ public function throwIf($condition): self { diff --git a/src/Retry/Backoff.php b/src/Retry/Backoff.php index 8e732ae..ab1dc1c 100644 --- a/src/Retry/Backoff.php +++ b/src/Retry/Backoff.php @@ -2,9 +2,9 @@ declare(strict_types=1); -namespace Jenky\Atlas\Retry; +namespace Fansipan\Retry; -use Jenky\Atlas\Contracts\DelayStrategyInterface; +use Fansipan\Contracts\DelayStrategyInterface; class Backoff implements DelayStrategyInterface { diff --git a/src/Retry/Delay.php b/src/Retry/Delay.php index 5bfe772..35a174b 100644 --- a/src/Retry/Delay.php +++ b/src/Retry/Delay.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Jenky\Atlas\Retry; +namespace Fansipan\Retry; +use Fansipan\Contracts\DelayStrategyInterface; use InvalidArgumentException; -use Jenky\Atlas\Contracts\DelayStrategyInterface; class Delay implements DelayStrategyInterface { diff --git a/src/Retry/GenericRetryStrategy.php b/src/Retry/GenericRetryStrategy.php index 81138a6..7d1cf75 100644 --- a/src/Retry/GenericRetryStrategy.php +++ b/src/Retry/GenericRetryStrategy.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Jenky\Atlas\Retry; +namespace Fansipan\Retry; -use Jenky\Atlas\Contracts\DelayStrategyInterface; -use Jenky\Atlas\Contracts\RetryStrategyInterface; +use Fansipan\Contracts\DelayStrategyInterface; +use Fansipan\Contracts\RetryStrategyInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; @@ -31,7 +31,7 @@ final class GenericRetryStrategy implements RetryStrategyInterface private $statusCodes; /** - * @var \Jenky\Atlas\Contracts\DelayStrategyInterface + * @var \Fansipan\Contracts\DelayStrategyInterface */ private $delayStrategy; diff --git a/src/Retry/RetryCallback.php b/src/Retry/RetryCallback.php index bad8f8b..94765dc 100644 --- a/src/Retry/RetryCallback.php +++ b/src/Retry/RetryCallback.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Jenky\Atlas\Retry; +namespace Fansipan\Retry; use Closure; -use Jenky\Atlas\Contracts\DelayStrategyInterface; -use Jenky\Atlas\Contracts\RetryStrategyInterface; +use Fansipan\Contracts\DelayStrategyInterface; +use Fansipan\Contracts\RetryStrategyInterface; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; diff --git a/src/Retry/RetryContext.php b/src/Retry/RetryContext.php index 4edf3b8..45257f6 100644 --- a/src/Retry/RetryContext.php +++ b/src/Retry/RetryContext.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Retry; +namespace Fansipan\Retry; final class RetryContext { diff --git a/src/Traits/ConnectorTrait.php b/src/Traits/ConnectorTrait.php index 9058c3a..6cfd488 100644 --- a/src/Traits/ConnectorTrait.php +++ b/src/Traits/ConnectorTrait.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace Jenky\Atlas\Traits; +namespace Fansipan\Traits; -use Jenky\Atlas\Contracts\PipelineInterface; -use Jenky\Atlas\Pipeline; -use Jenky\Atlas\Request; -use Jenky\Atlas\Response; -use Jenky\Atlas\Util; +use Fansipan\Contracts\PipelineInterface; +use Fansipan\Pipeline; +use Fansipan\Request; +use Fansipan\Response; +use Fansipan\Util; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; diff --git a/src/Traits/HasClient.php b/src/Traits/HasClient.php index b1e3549..eddbdad 100644 --- a/src/Traits/HasClient.php +++ b/src/Traits/HasClient.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace Jenky\Atlas\Traits; +namespace Fansipan\Traits; use Http\Discovery\Psr18ClientDiscovery; use Psr\Http\Client\ClientInterface; diff --git a/src/Traits/HasMiddleware.php b/src/Traits/HasMiddleware.php index 8a918a2..2cd4eb7 100644 --- a/src/Traits/HasMiddleware.php +++ b/src/Traits/HasMiddleware.php @@ -2,16 +2,16 @@ declare(strict_types=1); -namespace Jenky\Atlas\Traits; +namespace Fansipan\Traits; -use Jenky\Atlas\Middleware; +use Fansipan\Middleware; trait HasMiddleware { /** * The middleware instance. * - * @var \Jenky\Atlas\Middleware + * @var \Fansipan\Middleware */ private $middleware; diff --git a/src/Traits/Macroable.php b/src/Traits/Macroable.php index 23943f0..953389c 100644 --- a/src/Traits/Macroable.php +++ b/src/Traits/Macroable.php @@ -1,6 +1,6 @@