diff --git a/.github/workflows/Quickstart Symfony.yaml b/.github/workflows/Quickstart Symfony.yaml index 5641b00..b337ac5 100644 --- a/.github/workflows/Quickstart Symfony.yaml +++ b/.github/workflows/Quickstart Symfony.yaml @@ -50,13 +50,13 @@ jobs: ScriptFUSION\Porter\Porter: arguments: - '@providers' - + providers: class: Symfony\Component\DependencyInjection\ServiceLocator arguments: - - '@ScriptFUSION\Porter\Provider\Steam\SteamProvider' - + ScriptFUSION\Porter\Provider\Steam\SteamProvider: ~ . @@ -65,17 +65,17 @@ jobs: cat <<'.' | >src/Controller/AppListAction.php sed 's/ *//' import(new ImportSpecification(new GetAppList())) as $app) { + foreach ($porter->import(new Import(new GetAppList())) as $app) { echo "$app[appid]\n"; } }, diff --git a/.github/workflows/Quickstart.yaml b/.github/workflows/Quickstart.yaml index be0d6fb..1141e93 100644 --- a/.github/workflows/Quickstart.yaml +++ b/.github/workflows/Quickstart.yaml @@ -33,6 +33,11 @@ jobs: - name: Initialize Composer project run: composer init --name foo/bar + - name: Configure minimum stability for Amp v3. + run: | + composer config minimum-stability beta + composer config prefer-stable true + - name: Require ECB run: composer require provider/european-central-bank @@ -45,10 +50,10 @@ jobs: set(EuropeanCentralBankProvider::class, new EuropeanCentralBankProvider); $porter = new Porter($container); - $rates = $porter->import(new ImportSpecification(new DailyForexRates)); + $rates = $porter->import(new Import(new DailyForexRates)); foreach ($rates as $rate) { echo "$rate[currency]: $rate[rate]\n"; @@ -64,7 +69,7 @@ jobs: . - name: Test output contains USD - run: "grep --perl-regexp '^USD: [\\d.]+$' out" + run: 'grep --perl-regexp ''^USD: [\d.]+$'' out' - name: Test output contains between 30-40 lines run: | diff --git a/README.md b/README.md index 1de531f..067c11a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ Porter ====== -[![Latest version][Version image]][Releases] -[![Total downloads][Downloads image]][Downloads] -[![Build status][Build image]][Build] -[![Mutation score][MSI image]][MSI report] -[![Test coverage][Coverage image]][Coverage] +[![Version image]][Releases] +[![Downloads image]][Downloads] +[![Build image]][Build] +[![Quickstart image]][Quickstart build] +[![Quickstart Symfony image]][Quickstart Symfony build] +[![Coverage image]][Coverage] +[![Mutation score image][MSI image]][MSI report] -### Durable and concurrent data imports for consuming data at scale and publishing testable SDKs +### Durable and asynchronous data imports for consuming data at scale and publishing testable SDKs Porter is the all-purpose PHP data importer. She fetches data from APIs, web scraping or anywhere and serves it as an iterable [record collection](#record-collections), encouraging processing one record at a time instead of loading full data sets into memory. [Durability](#durability) features provide automatic, transparent recovery from intermittent network errors by default. @@ -214,7 +216,7 @@ Synchronously, we seldom trip protection measures even for high volume imports, A `DualThrottle` can be assigned by modifying the import specification as follows. ```php -(new AsyncImportSpecification)->setThrottle(new DualThrottle) +(new Import)->setThrottle(new DualThrottle) ``` #### ThrottledConnector @@ -534,15 +536,19 @@ Porter is supported by [JetBrains for Open Source][] products. [Downloads image]: https://poser.pugx.org/scriptfusion/porter/downloads "Total downloads" [Build]: https://github.com/ScriptFUSION/Porter/actions/workflows/Tests.yaml [Build image]: https://github.com/ScriptFUSION/Porter/actions/workflows/Tests.yaml/badge.svg "Build status" - [MSI image]: https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FScriptFUSION%2FPorter%2Fmaster + [Quickstart build]: https://github.com/ScriptFUSION/Porter/actions/workflows/Quickstart.yaml + [Quickstart image]: https://github.com/ScriptFUSION/Porter/actions/workflows/Quickstart.yaml/badge.svg "Quick start build status" + [Quickstart Symfony build]: https://github.com/ScriptFUSION/Porter/actions/workflows/Quickstart%20Symfony.yaml + [Quickstart Symfony image]: https://github.com/ScriptFUSION/Porter/actions/workflows/Quickstart%20Symfony.yaml/badge.svg "Symfony quick start build status" [MSI report]: https://dashboard.stryker-mutator.io/reports/github.com/ScriptFUSION/Porter/master + [MSI image]: https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2FScriptFUSION%2FPorter%2Fmaster "Mutation score" [Coverage]: https://codecov.io/gh/ScriptFUSION/Porter [Coverage image]: https://codecov.io/gh/ScriptFUSION/Porter/branch/master/graphs/badge.svg "Test coverage" [Issues]: https://github.com/ScriptFUSION/Porter/issues [PRs]: https://github.com/ScriptFUSION/Porter/pulls [Quickstart]: https://github.com/ScriptFUSION/Porter/tree/master/docs/Quickstart.md - [Symfony quickstart]: https://github.com/ScriptFUSION/Porter/tree/master/docs/Quickstart%20Symfony.md + [Symfony quickstart]: https://github.com/ScriptFUSION/Porter/tree/master/docs/Quickstart%20Symfony.md [Provider]: https://github.com/provider [Porter transformers]: https://github.com/Porter-transformers [Porter connectors]: https://github.com/Porter-connectors diff --git a/docs/Quickstart Symfony.md b/docs/Quickstart Symfony.md index dbb764a..0a28421 100644 --- a/docs/Quickstart Symfony.md +++ b/docs/Quickstart Symfony.md @@ -137,14 +137,14 @@ Refreshing our browser now should recompile the Symfony DI container and show us Let's replace the previous `StreamedResponse` closure with a new implementation that uses Porter to import data from the `GetAppList` resource (a resource belonging to `SteamProvider`). ```diff ++use ScriptFUSION\Porter\Import\Import; use ScriptFUSION\Porter\Porter; +use ScriptFUSION\Porter\Provider\Steam\Resource\GetAppList; -+use ScriptFUSION\Porter\Specification\ImportSpecification; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; - fn () => print 'Hello, Porter!', + function () use ($porter): void { -+ foreach ($porter->import(new ImportSpecification(new GetAppList())) as $app) { ++ foreach ($porter->import(new Import(new GetAppList())) as $app) { + echo "$app[appid]\n"; + } + }, @@ -158,9 +158,9 @@ declare(strict_types=1); namespace App\Controller; +use ScriptFUSION\Porter\Import\Import; use ScriptFUSION\Porter\Porter; use ScriptFUSION\Porter\Provider\Steam\Resource\GetAppList; -use ScriptFUSION\Porter\Specification\ImportSpecification; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\StreamedResponse; @@ -173,7 +173,7 @@ final class AppListAction extends AbstractController { return new StreamedResponse( function () use ($porter): void { - foreach ($porter->import(new ImportSpecification(new GetAppList())) as $app) { + foreach ($porter->import(new Import(new GetAppList())) as $app) { echo "$app[appid]\n"; } }, diff --git a/docs/Quickstart.md b/docs/Quickstart.md index f11d1cf..d05f88f 100644 --- a/docs/Quickstart.md +++ b/docs/Quickstart.md @@ -13,6 +13,12 @@ composer init For this demo we'll use the [European Central Bank][ECB provider] (ECB) provider by including it in our `composer.json` with the following command. +>Note: The ECB provider requires [Amp v3][], which is currently in beta, so we need to allow beta dependencies temporarily. This can be enabled with the following commands. +> ```sh +> composer config minimum-stability beta +> composer config prefer-stable true +> ``` + ```sh composer require provider/european-central-bank ``` @@ -77,3 +83,4 @@ This just scratches the surface of Porter without going into any details. Explor [PSR-11 search]: https://packagist.org/explore/?type=library&tags=psr-11 [Joomla DI]: https://github.com/joomla-framework/di [Symfony quickstart guide]: Quickstart%20Symfony.md + [Amp v3]: https://v3.amphp.org diff --git a/test/phpunit.xml b/test/phpunit.xml index 695737b..e140a3a 100644 --- a/test/phpunit.xml +++ b/test/phpunit.xml @@ -1,5 +1,6 @@ .