seravo/seravo-plugin
Composer 安装命令:
composer require seravo/seravo-plugin
包简介
Enhances WordPress with Seravo.com specific features and integrations
README 文档
README
Seravo Must-use Plugin
Enhances WordPress with Seravo.com specific features and integrations (also known as WP-palvelu.fi in Finland).
Installation
In order to use this with composer you need to add this mu-plugin:
https://github.com/roots/bedrock/blob/master/web/app/mu-plugins/bedrock-autoloader.php
This is because WordPress won't use mu-plugins from their own folders.
Then add this to your composer:
{
"require": {
"seravo/seravo-plugin": "*"
},
"extra": {
"installer-paths": {
"htdocs/wp-content/mu-plugins/{$name}/": ["type:wordpress-muplugin"]
}
}
}
Seravo's customers can simply run wp-seravo-plugin-update to get the latest (tagged) release. For the adventurous, get the git master head with wp-seravo-plugin-update --dev.
Features
- Enforces canonical URLs
- Enforces HTTPS, nags if PHP version is too low, shows a notice is object-cache is not enabled etc
- Shows notifications from WP-palvelu.fi (@TODO: switch to Seravo.com)
- Returns 401 (unauthorized) http status code after failed login.
- Logs all login attempts to /data/log/wp-login.log
- Hides Update nagging since that is handled by Seravo
- Uses nocache headers if the site is in development mode
- Adds Purge Cache -button in adminbar
- Automatically shows the shadow instance switcher is there are any shadow instances.
- Allows to list and reset shadow environments
- Finds and suggests cruft files to remove from a site
- Shows information about the database, table sizes etc
- Show information about disk usage, server logs, updates, tests etc
- And lots, lots more!
Filters
You can insert your own admin notice for users that are in shadow
function my_shadow_admin_notice($admin_notice, $current_screen) { return '<div class="notice notice-error"><p>This is staging. All content edited here will be lost. Return to production to create or edit content.</p></div>'; } add_filter( 'seravo_instance_switcher_admin_notice', 'my_shadow_admin_notice', 10, 2 );
Currently the velocity of development is so high that documentation lacks badly behind. To find more filters, just search the source code for apply_filters.
Development
Using a real site for development
Some of the features in the Seravo Plugin depend on the API that is available only on a real production site, and thus cannot be tested inside a Vagrant box or the like.
In order to have the git repository on your own computer and in your own editor, while still being able to see the code running on a test site (in the production environment) you can use the command below. It will watch all files for changes and automatically rsync them to the remote server:
seravo-plugin$ find * | entr rsync -avz -e 'ssh -q -p 12345' * example@example.seravo.com:/data/wordpress/htdocs/wp-content/mu-plugins/seravo-plugin/
sending incremental file list
README.md
sent 2,999 bytes received 64 bytes 2,042.00 bytes/sec
total size is 370,596 speedup is 120.99
Installing development dependencies
To ease Seravo Plugin development, composer should be used to install development dependencies.
Running composer install installs PHPCS, PHPCBF, WordPress PHPCS standards and Rector.
Updating translations
Remember to update translations of all public facing string by running inside Vagrant:
cd /data/wordpress/htdocs/wp-content/mu-plugins/seravo-plugin
wp i18n make-pot . languages/seravo.pot
NOTE! If this fails on
PHP Fatal error: Uncaught Error: Maximum function nesting level of '256' reachedtemporarily remove the overly complex files withrm js/cruft*.
Translations can be done for instance by using Poedit. On editor open languages/seravo-fi.po and select Update from pot file which will update the po file. After translating compile the po file to seravo-fi.mo mo file.
Running Rector and PHPCS
If you have Rector and PHPCS installed locally with composer install, simply run composer test. Alternatively run PHPCS inside local Vagrant or Docker image, or on the same remote site used for testing:
ssh -q -p 12345 example@example.seravo.com 'cd '/data/wordpress/htdocs/wp-content/mu-plugins/seravo-plugin/ && phpcs
........S.......WWWWWWWWWWEWWEWWWWW.WWEWWWW.W.WWEWWEWEW..... 60 / 68 (88%)
......W. 68 / 68 (100%)
FILE: ...press/htdocs/wp-content/mu-plugins/seravo-plugin/lib/helpers.php
----------------------------------------------------------------------
FOUND 0 ERRORS AND 3 WARNINGS AFFECTING 2 LINES
----------------------------------------------------------------------
35 | WARNING | Filesystem function dirname() detected with dynamic
| | parameter
35 | WARNING | Line exceeds 100 characters; contains 118 characters
44 | WARNING | Line exceeds 100 characters; contains 107 characters
----------------------------------------------------------------------
...
Rector and PHPCS errors can be automatically fixed with composer fix. All Rector errors should be resolved
before merging to master even if it's not part of CI tests.
Changelog
See git history and release commit messages.
seravo/seravo-plugin 适用场景与选型建议
seravo/seravo-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 169.17k 次下载、GitHub Stars 达 40, 最近一次更新时间为 2017 年 02 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「wp」 「wp-palvelu」 「seravo」 「seravo.com」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 seravo/seravo-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 seravo/seravo-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 seravo/seravo-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Enhances WordPress with Seravo.com specific features and integrations
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
Seravo WordPress project template
Inertia.js server-side adapter for PHP. Handles full visits, Inertia XHR visits, asset-version 409 handshakes and partial reloads. Framework-agnostic, with transparent WordPress integration.
Adds Cache-Tag HTTP response headers for singular WordPress content and purges Cloudflare by tag when content changes.
AI Chatbot & Helpdesk Agent for WooCommerce. Connects your store to Egentify for AI-powered chat, order tracking, email, and ticketing.
统计信息
- 总下载量: 169.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 40
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2017-02-16