Fetching and transforming data from API to JSON-LD using spatie/schema-org
-
Clone the repository:
git clone https://github.com/helsingborg-stad/schema.org-transformer.git
-
Install dependencies:
composer install
To run the router script, use the following command:
Usage: php router.php
Input settings
--source <file|url> Input file or URL
--sourceheaders <headers> Comma separated HTTP headers when source is a URL
Output settings
--output <file|url> Output file or URL
--outputheaders <headers> Comma separated HTTP headers when output is a URL
--outputformat <json|jsonl> Output format
Transformation settings
--transform <jobposting> Name of transform to apply
OAuth authentication parameters (Applicable for source only)
--authpath <url> URL of token service
--authclientid <string> Client id
--authclientsecret <string> Client secret
Example:
php router.php --source https://reachmee --output /tmp/output.json --transform jobposting
You can add additional transforms to the Transforms folder.
- Fork the repository.
- Create a new branch (
git checkout -b feature-name
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-name
). - Create a new pull request.
This project is licensed under the MIT License.