定制 craftcms/apple-news 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

craftcms/apple-news

Composer 安装命令:

composer require craftcms/apple-news

包简介

Publish Craft CMS entries to Apple News

README 文档

README

Apple News icon

Apple News

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 Begin

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 SettingsChannel InfoConnect CMSAPI Key in News Publisher.

Requirements

This plugin requires Craft CMS 5.0.0+.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

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.

With Composer

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

Configuration

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 configs
  • autoPublishOnSave (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

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.

Autoloading your Channel Classes

To make your channel classes auto-loadable, add a new autoload root to composer.json for your channel and article classes, and then run composer dump-autoload.

{
  "autoload": {
    "psr-4": {
      "applenewschannels\\": "config/apple-news-channels/"
    }
  }
}

Usage

Once your Channel classes are set up and included properly, a new Apple News Channels area appear in the details pane of Edit Entry pages, for entries that have at least one matching channel.

The Apple News Channels area within an Edit Entry page

Each channel will display an action menu beside it with some of the following options, depending on the state of the article:

  • Publish to Apple News – Queues the article to be published to Apple News.
  • Copy share URL – Displays a prompt that allows the user to copy the article’s share URL.
  • Download for News Preview – Downloads the entry’s article.json (and other files), which can be loaded into the News Preview app, to see exactly how your article will look on various iOS devices once published.

There will also be a new Publish to Apple News bulk action on the Entries index page, which makes it possible to queue up several entries to be published at once.

The “Publish to Apple News” bulk entry action

Resources

You can learn more about publishing on Apple News at the following resources:

Caveats

Please be aware of the following caveats:

  • Entries with a Post Date set in the future won’t be automatically published to Apple News when they go live.

Thanks

Many thanks to Chapter Three for their excellent AppleNewsAPI library.

craftcms/apple-news 适用场景与选型建议

craftcms/apple-news 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23.47k 次下载、GitHub Stars 达 42, 最近一次更新时间为 2019 年 09 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「yii2」 「craftcms」 「apple news」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 craftcms/apple-news 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 craftcms/apple-news 我们能提供哪些服务?
定制开发 / 二次开发

基于 craftcms/apple-news 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 23.47k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 42
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 42
  • Watchers: 6
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-21