{"id":20766724,"url":"https://github.com/chapter-three/applenewsapi","last_synced_at":"2025-04-09T14:14:06.639Z","repository":{"id":34379573,"uuid":"38305913","full_name":"chapter-three/AppleNewsAPI","owner":"chapter-three","description":"This is a PHP library that allows you to publish content to Apple News and construct documents in the Apple News JSON format.","archived":false,"fork":false,"pushed_at":"2024-06-23T14:09:41.000Z","size":1878,"stargazers_count":38,"open_issues_count":17,"forks_count":26,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-04-02T12:08:34.004Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":"Unmaintained","scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chapter-three.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-30T11:40:34.000Z","updated_at":"2024-09-26T02:43:33.000Z","dependencies_parsed_at":"2024-06-19T00:11:53.853Z","dependency_job_id":"dbebc00a-843f-4def-a945-655516ba802e","html_url":"https://github.com/chapter-three/AppleNewsAPI","commit_stats":{"total_commits":263,"total_committers":6,"mean_commits":"43.833333333333336","dds":0.3269961977186312,"last_synced_commit":"73fd89ff1e3ad59f362a9e7f3276b40641bf8ec2"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chapter-three%2FAppleNewsAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chapter-three%2FAppleNewsAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chapter-three%2FAppleNewsAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chapter-three%2FAppleNewsAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chapter-three","download_url":"https://codeload.github.com/chapter-three/AppleNewsAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T11:25:50.538Z","updated_at":"2025-04-09T14:14:06.616Z","avatar_url":"https://github.com/chapter-three.png","language":"PHP","readme":"# AppleNewsAPI\n\n[![Travis CI build status](https://travis-ci.org/chapter-three/AppleNewsAPI.svg?branch=master)](https://travis-ci.org/chapter-three/AppleNewsAPI)\n\n`AppleNewsAPI\\PublisherAPI` is a PHP library that allows you to publish content to Apple News. You can also retrieve and delete articles you’ve already published, and get basic information about your channel and sections.\n\n`AppleNewsAPI\\Document` is a PHP library that helps construct documents in the [Apple News JSON format](https://developer.apple.com/library/ios/documentation/General/Conceptual/Apple_News_Format_Ref/).\n\n[API Documentation](http://chapter-three.github.io/AppleNewsAPI/)\n\n## Installation\n\n```shell\ncomposer require chapter-three/apple-news-api\n```\n\nor\n\n```shell\ngit clone git@github.com:chapter-three/AppleNewsAPI.git\ncd AppleNewsAPI\ncurl -sS https://getcomposer.org/installer | php\n./composer.phar install\n```\n\n## Document class Quick Start and Examples\n\n```php\nuse ChapterThree\\AppleNewsAPI\\Document;\nuse ChapterThree\\AppleNewsAPI\\Document\\Components\\Body;\nuse ChapterThree\\AppleNewsAPI\\Document\\Layouts\\Layout;\nuse ChapterThree\\AppleNewsAPI\\Document\\Styles\\ComponentTextStyle;\n\n$obj = new Document(uniqid(), 'title', 'en', new Layout(7, 1024));\n$obj-\u003eaddComponent(new Body('body text'))\n  -\u003eaddComponentTextStyle('default', new ComponentTextStyle());\n\n$json = $obj-\u003ejson();\n```\n\n## PublisherAPI class Quick Start and Examples\n\n```php\n$api_key_id = \"\";\n$api_key_secret = \"\";\n$endpoint = \"https://endpoint_url\";\n\n$PublisherAPI = new ChapterThree\\AppleNewsAPI\\PublisherAPI(\n  $api_key_id,\n  $api_key_secret,\n  $endpoint\n);\n```\n\n##### GET Channel\n\n```php\n// Fetches information about a channel.\n$response = $PublisherAPI-\u003eget('/channels/{channel_id}',\n  [\n    'channel_id' =\u003e CHANNEL_ID\n  ]\n);\n```\n\n##### GET Sections\n\n```php\n// Fetches a list of all sections for a channel.\n$response = $PublisherAPI-\u003eget('/channels/{channel_id}/sections',\n  [\n    'channel_id' =\u003e CHANNEL_ID\n  ]\n);\n```\n\n##### GET Section\n\n```php\n// Fetches information about a single section.\n$response = $PublisherAPI-\u003eget('/sections/{section_id}',\n  [\n    'section_id' =\u003e SECTION_ID\n  ]\n);\n```\n\n##### GET Article\n\n```php\n// Fetches an article.\n$response = $PublisherAPI-\u003eget('/articles/{article_id}',\n  [\n    'article_id' =\u003e ARTICLE_ID\n  ]\n);\n```\n\n##### POST Article\n\n```php\n// Publishes a new article to a channel.\n// $response contains an article ID and revision ID.\n$response = $PublisherAPI-\u003epost('/channels/{channel_id}/articles',\n  [\n    'channel_id' =\u003e CHANNEL_ID\n  ],\n  [\n    // List of files to POST\n    'files' =\u003e [], // optional. A list of article assets [uri =\u003e path]\n    // JSON metadata string\n    'metadata' =\u003e $metadata, // required\n    'json' =\u003e '', // required. Apple News Native formatted JSON string.\n  ]\n);\n```\n\n##### UPDATE Article\n\n```php\n// Metadata information `revision` is required.\n$metadata = json_encode([\n  'data' =\u003e [\n    'revision' =\u003e REVISION_ID\n  ]\n]);\n// Updates an existing article.\n// See $response variable to get a new revision ID.\n$response = $PublisherAPI-\u003epost('/articles/{article_id}',\n  [\n    'article_id' =\u003e ARTICLE_ID\n  ],\n  [\n    // List of files to POST\n    'files' =\u003e [], // optional. A list of article assets [uri =\u003e path]\n    // JSON metadata string\n    'metadata' =\u003e $metadata, // required\n    // Apple News Native formatted JSON string. See examples.\n    'json' =\u003e '', // required.\n  ]\n);\n```\n\n##### DELETE Article\n\n```php\n// Deletes an article.\n$response = $PublisherAPI-\u003edelete('/articles/{article_id}',\n  [\n    'article_id' =\u003e ARTICLE_ID\n  ]\n);\n```\n\n## Contribute\n\n### Run Unit Tests\n\n```shell\n./vendor/bin/phpunit -v --colors=auto --bootstrap vendor/autoload.php tests\n```\n\nTo test PublisherAPI GET/POST/DELETE methods use the following pattern:\n\n```shell\n./vendor/bin/phpunit -v --colors=auto --bootstrap vendor/autoload.php\ntests/PublisherAPITest.php [API_KEY] [API_SECRET] [ENDPOINT_URL] [METHOD] [ENDPOINT_PATH]\n```\n\n### Generate PHPDoc\n\n```shell\ngit clone --branch gh-pages git@github.com:chapter-three/AppleNewsAPI.git ../AppleNewsAPI_phpdoc\n./vendor/bin/phpdoc run --title='chapter-three/apple-news-api v'$(cat composer.json | jq -r '.version') -d ./ -i vendor/,tests/ -t ../AppleNewsAPI_phpdoc\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchapter-three%2Fapplenewsapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchapter-three%2Fapplenewsapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchapter-three%2Fapplenewsapi/lists"}