-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add 8.1 to composer & php workflow * Add branch to php workflow * Test PHP8.1 updates * Remove 7.4 support from test * Remove old checkout action * Fix PHP8.1 issues * Add 8.2, 8.3 * Code quality fixes * PHPStan fixes * Use native union types * Docs reorganisation * Move phplint to GitHub action * Make data providers public static * PHPStan 4 fixes * feat!: Require Symfony 6 / PHP 8.1 * Test in Symfony 6 & 7 * Fix to php -v * Testing lock GitHub action to Symfony 6/7 * Exclude PHP 8.1 & Symfony 7 * test
- Loading branch information
1 parent
f9d9680
commit 7a57343
Showing
91 changed files
with
696 additions
and
1,290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: release-please | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
# Uses https://github.com/marketplace/actions/release-please-action | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: googleapis/release-please-action@v4 | ||
with: | ||
release-type: php | ||
package-name: strata/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,39 @@ | ||
# Data | ||
|
||
The purpose of this package is to help read data from APIs and other external sources. | ||
A simple way to manage data retrieval from APIs and other sources. This package is built using Symfony components and can | ||
be used with any PHP application, Symfony, Laravel or plain PHP. | ||
|
||
Features: | ||
You can: | ||
|
||
* Download data via HTTP APIs | ||
* Throw exceptions on failed requests | ||
* Supports REST and GraphQL | ||
* Decode data from a variety of formats (e.g. JSON, Markdown) | ||
* Automated debug information (logging and time profiling) | ||
* Read data from REST and GraphQL APIs | ||
* Authenticate with APIs | ||
* Handle errors consistently | ||
* Cache requests to increase performance | ||
* Tools to help detect whether data has changed since last request | ||
* Transform data (e.g. convert source category to match local category name) | ||
* Decode data from a variety of formats (e.g. JSON, Markdown) | ||
* Transform data (e.g. map a category name) | ||
* Work out if data has changed since the last request | ||
|
||
Planned for the future: | ||
See the [documentation](docs/README.md) for more. | ||
|
||
* Validate data items to see whether they contain required data properties | ||
* Efficient bulk API queries via concurrent requests | ||
* Download data via local, FTP, S3 filesystem (via Flysystem) | ||
You can use this with the [frontend](https://github.com/strata/frontend) package to help you build a frontend website. | ||
|
||
## Status | ||
Please note this software is in development, usage may change before the 1.0 release. | ||
|
||
## Requirements | ||
|
||
* PHP 7.4+ | ||
* PHP 8.1+ | ||
* [Composer](https://getcomposer.org/) | ||
|
||
## Installation | ||
|
||
Install via Composer: | ||
|
||
``` | ||
composer require strata/data:^0.8 | ||
composer require strata/data:^0.9 | ||
``` | ||
|
||
## Documentation | ||
|
||
See [docs](docs/README.md) - these are currently being cleaned up and we plan to publish better docs for v0.10. | ||
|
||
## Thanks to | ||
|
||
https://developer.happyr.com/http-client-and-caching | ||
* [Symfony](https://symfony.com/) | ||
* https://developer.happyr.com/http-client-and-caching |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,23 +6,20 @@ | |
"authors": [ | ||
{ | ||
"name": "Simon Jones", | ||
"email": "[email protected]", | ||
"homepage": "https://studio24.net/", | ||
"role": "Developer" | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "^7.4|^8.0", | ||
"ext-json": "*", | ||
"symfony/http-client": "^5.4|^6.0", | ||
"php": "^8.1", | ||
"erusev/parsedown-extra": "^0.8", | ||
"laminas/laminas-feed": "^2.22", | ||
"league/commonmark": "^2.4", | ||
"spatie/yaml-front-matter": "^2.0", | ||
"erusev/parsedown-extra": "^0.8.1", | ||
"symfony/cache": "^5.4|^6.0", | ||
"symfony/stopwatch": "^5.4|^6.0", | ||
"symfony/monolog-bundle": "^3.7", | ||
"symfony/property-access": "^5.4|^6.0", | ||
"laminas/laminas-feed": "^2.16", | ||
"league/commonmark": "^2.2" | ||
"symfony/http-client": "^6.4|^7.1", | ||
"symfony/cache": "^6.4|^7.1", | ||
"symfony/stopwatch": "^6.4|^7.1", | ||
"symfony/property-access": "^6.4|^7.1", | ||
"symfony/monolog-bundle": "^3.7" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
|
@@ -31,39 +28,37 @@ | |
"exclude-from-classmap": ["/tests/"] | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9", | ||
"squizlabs/php_codesniffer": "^3.5", | ||
"phpstan/phpstan": "^1.0", | ||
"overtrue/phplint": "^3.0", | ||
"phpunit/phpunit": "^10.5", | ||
"squizlabs/php_codesniffer": "^3.10", | ||
"phpstan/phpstan": "^1.11", | ||
"roave/security-advisories": "dev-latest" | ||
}, | ||
"scripts": { | ||
"lint": [ | ||
"./vendor/bin/phplint" | ||
], | ||
"cs": [ | ||
"phpcs": [ | ||
"./vendor/bin/phpcs" | ||
], | ||
"fix": [ | ||
"phpcbf": [ | ||
"./vendor/bin/phpcbf" | ||
], | ||
"unit": [ | ||
"phpunit": [ | ||
"./vendor/bin/phpunit" | ||
], | ||
"phpstan": [ | ||
"./vendor/bin/phpstan analyse --memory-limit 512M" | ||
], | ||
"test": [ | ||
"composer lint", | ||
"composer cs", | ||
"composer unit" | ||
"composer phpcs", | ||
"composer phpunit" | ||
] | ||
}, | ||
"scripts-descriptions": { | ||
"lint": "Lint PHP files", | ||
"cs": "Test coding standards are met in PHP code", | ||
"fix": "Fix PHP code so it meets coding standards", | ||
"unit": "Run PHPUnit tests", | ||
"test": "Run all tests (phplint, phpcs, phpunit)" | ||
}, | ||
"config": { | ||
"allow-plugins": false | ||
}, | ||
|
||
"extra": { | ||
"symfony": { | ||
"allow-contrib": false, | ||
"require": "7.2.*" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,47 @@ | ||
# Introduction | ||
|
||
_Please note: documentation is in progress._ | ||
A simple way to manage data retrieval from APIs and other sources. This package is built using Symfony components and can | ||
be used with any PHP application, Symfony, Laravel or plain PHP. | ||
|
||
You can use this with the [frontend](https://github.com/strata/frontend) package to help you build a frontend website. | ||
|
||
You can: | ||
|
||
* Read data from REST and GraphQL APIs | ||
* Authenticate with APIs | ||
* Handle errors consistently | ||
* Cache requests to increase performance | ||
* Decode data from a variety of formats (e.g. JSON, Markdown) | ||
* Transform data (e.g. map a category name) | ||
* Work out if data has changed since the last request | ||
|
||
## Changelog | ||
|
||
All notable changes to strata/data are documented on [GitHub](https://github.com/strata/data/blob/main/CHANGELOG.md). | ||
|
||
## Retrieving data | ||
|
||
Strata Data has a lightweight architecture. | ||
|
||
Data is retrieved via a **[Data provider](retrieving-data/data-providers.md)** . This could be a REST API, GraphQL API, or other source. | ||
Data providers wrap up data reading functionality along with support for **[caching](advanced-usage/caching.md)**, decoding raw data, error handling and helpers to make development easier. | ||
|
||
You use **[queries](retrieving-data/query.md)** to make running a data request easier. | ||
A **[query manager](retrieving-data/query-manager.md)** can be used to manage multiple queries. | ||
|
||
Single data is returned as either an object or array. | ||
|
||
A collection of data is returned as a collection object, containing either objects or arrays. | ||
|
||
## Changing data | ||
|
||
Returned data can be modified via **[transformers](changing-data/transformers.md)** or **[mappers](changing-data/mapping.md)**. Transformers change data, while mappers map data to an object or array. | ||
|
||
**[Pagination](changing-data/mapping#setting-pagination)** can be automated when you return a collection of results. | ||
|
||
## Advanced usage | ||
|
||
You can [validate data](advanced-usage/validating.md) to check it is valid. This is useful if you need to check data before you use it (e.g. a data import). | ||
|
||
[Data history](data-history.md) can be used to help determine if retrieved data has changed since last access. | ||
|
||
Read and write data from external data providers in a standardised format. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# About | ||
|
||
Strata is developed by [Studio 24](https://www.studio24.net/), a digital design and development agency | ||
based in Cambridge, UK, focussed on building accessible, sustainable websites and web apps that work for everyone. | ||
|
||
You can [get in touch](https://www.studio24.net/contact/) about how we can help on your PHP web application project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.