This plugin provides an Apple News integration for Craft CMS, making it possible to publish your content to iPhone, iPad, and Mac users around the world.
Before you can start publishing to Apple News, you’ll need to sign up for News Publisher and create your first channel. Make sure you choose to publish with Apple News Format when asked. Note that new channels must go through an approval process before they can be used.
Once you’ve created a channel, you’ll need to write down its Channel ID and API credentials. You can get those from Settings → Channel Info → Connect CMS → API Key in News Publisher.
This plugin requires Craft CMS 5.0.0+.
You can install this plugin from the Plugin Store or with Composer.
Go to the Plugin Store in your project’s Control Panel and search for Apple News. Then click on the Install button in its modal window.
Open your terminal and run the following commands:
# go to the project directory
cd /path/to/my-project.test
# tell Composer to load the plugin
composer require craftcms/apple-news
# tell Craft to install the plugin
./craft install/plugin apple-news
Publish to Apple News gets its own configuration file, located at config/apple-news.php
. It can have the following config settings:
channels
(array) – List of channel class configsautoPublishOnSave
(bool) – Whether entries should be automatically published to Apple News whenever they are saved (true
by default)
Here’s an example:
<?php
return [
'channels' => [
[
'class' => applenewschannels\MyNewsChannel::class,
'channelId' => craft\helpers\App::env('NEWS_CHANNEL_ID'), // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
'apiKeyId' => craft\helpers\App::env('NEWS_API_KEY'), // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
'apiSecret' => craft\helpers\App::env('NEWS_API_SECRET'), // xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
],
],
];
Channel classes tell the plugin everything it needs to know to start publishing content Apple News. They should should extend craft\applenews\BaseChannel.
We recommend that you save your channel classes in config/apple-news-channels
and use an applenewschannels
namespace.
<?php
namespace applenewschannels;
// ...
An example channel class is provided at apple-news-channels/MyNewsChannel.php, which will more or less work with the “News” section within the Happy Lager demo site.