urbania / apple-news
v1.0.0
2026-11-03 14:48 UTC
Requires
- php: ^7.0|^8.0
- guzzlehttp/guzzle: ^6.3|^7.0
- illuminate/contracts: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
- illuminate/support: ^5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
- imangazaliev/didom: ^1.14
- symfony/css-selector: ^5.0|^6.0
- symfony/filesystem: ^5.0|^6.0
- webmozart/assert: ^1.4
Requires (Dev)
- doctrine/dbal: ^3.5
- fakerphp/faker: ^1.21
- mockery/mockery: ^1.5.1
- nette/php-generator: ^2.6|^3.2
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^9.0|^10.0.7
- squizlabs/php_codesniffer: *
- symfony/finder: ^5.0|^6.0
- vlucas/phpdotenv: ^5.4.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-11 14:28:59 UTC
README
This package offer a wrapper around the Apple News API and Apple News Format in PHP. It includes support for Laravel, Wordpress and an HTML parser.
Installation
composer require urbania/apple-news
Laravel
Versions prior to 5.5
- Add the Service Provider in the config file
config/app.php:
'providers' => [ // ... \Urbania\AppleNews\Laravel\AppleNewsServiceProvider::class, // ... ]
- Add the Facade in the config file
config/app.php:
'facades' => [ // ... 'AppleNews' => \Urbania\AppleNews\Laravel\AppleNewsFacade::class, // ... ]
All versions
Publish the config file to config/apple-news.php:
php artisan vendor:publish
Usage
Pure PHP
Create a test article:
require __DIR__ . '/vendor/autoload.php'; use Urbania\AppleNews\Article; $article = new Article([ 'identifier' => 'test-article', 'language' => 'en-US', 'version' => '1.7', 'layout' => [ 'columns' => 12, 'width' => 1024 ], 'title' => 'An article', 'components' => [ [ 'role' => 'title', 'text' => 'This is a title' ], [ 'role' => 'body', 'text' => 'This is a body' ] ] ]); echo $article->toJson();
Laravel
Create a test article: (when creating an article with the facade or the helper, it takes into account the default article values found in config/apple-news.php)
// Using the facade use AppleNews; $article = AppleNews::article([ 'identifier' => 'test-article', 'title' => 'An article', 'components' => [ [ 'role' => 'title', 'text' => 'This is a title' ], [ 'role' => 'body', 'text' => 'This is a body' ] ] ]); // Using the helper $article = article([ // ... same as above ]); echo $article->toJson();