typisttech/wp-admin-tabs
Composer 安装命令:
composer require typisttech/wp-admin-tabs
包简介
Create tabbed navigation for WordPress admin dashboard, the OOP way
关键字:
README 文档
README
Create tabbed navigation for WordPress admin dashboard, the OOP way.
- Install
- Usage
- Frequently Asked Questions
- Support
- Developing
- Running the Tests
- Feedback
- Change log
- Security
- Contributing
- Credits
- License
Install
Installation should be done via composer, details of how to install composer can be found at https://getcomposer.org/.
$ composer require typisttech/wp-admin-tabs
You should put all WP Admin Tabs classes under your own namespace to avoid class name conflicts.
Usage
Example
$adminTabCollection = new AdminTabCollection(); $adminTabCollection->add( new AdminTab('Blog', 'https://typist.tech'), new AdminTab('Plugins', admin_url('plugins.php')), new AdminTab('Users', admin_url('users.php')), new AdminTab('Tab A', admin_url('users.php')), new AdminTab('Tab B', admin_url('users.php')), ); // This echos the tabs: $adminTabCollection->render(); // This returns the HTML string of the tabs: $html = $adminTabCollection->toHtml();
AdminTab
__construct(string $menuTitle, string $url)
AdminTab constructor.
- @param string $menuTitle The menu title of this tab.
- @param string $url The url of this tab.
new AdminTab('Blog', 'https://typist.tech'); new AdminTab('Blog', admin_url('plugins.php'));
AdminTabCollection
add(AdminTab ...$adminTabs)
Add admin tabs.
- @param AdminTab[] ...$adminTabs Admin tabs to be added.
$adminTabCollection = new AdminTabCollection(); // Add single admin tab. $adminTabCollection->add( new AdminTab('Users', admin_url('users.php')) ); // Add multiple admin tabs. $adminTabCollection->add( new AdminTab('Blog', 'https://typist.tech'), new AdminTab('Plugins', admin_url('plugins.php')) );
render()
Render the tabs with echo.
$adminTabCollection = new AdminTabCollection(); $adminTabCollection->add( new AdminTab('Blog', 'https://typist.tech'), new AdminTab('Plugins', admin_url('plugins.php')), new AdminTab('Users', admin_url('users.php')) ); $adminTabCollection->render();
toHtml(): string
Converts the tabs to HTML string without echo.
$adminTabCollection = new AdminTabCollection(); $adminTabCollection->add( new AdminTab('Blog', 'https://typist.tech'), new AdminTab('Plugins', admin_url('plugins.php')), new AdminTab('Users', admin_url('users.php')) ); $adminTabCollection->toHtml();
Frequently Asked Questions
Is this a plugin?
No, this is a package that should be part of your plugin.
What to do when wp.org plugin team tell me to clean up the vendor folder?
Re-install packages via the following command. This package exports only necessary files to dist.
$ composer install --no-dev --prefer-dist --optimize-autoloader
Can two different plugins use this package at the same time?
Yes, if put all WP Admin Tabs classes under your own namespace to avoid class name conflicts.
Do you have real life examples that use this package?
Here you go:
Add your own plugin here
It looks awesome. Where can I find some more goodies like this?
- Articles on Typist Tech's blog
- Tang Rufus' WordPress plugins on wp.org
- More projects on Typist Tech's GitHub profile
- Stay tuned on Typist Tech's newsletter
- Follow Tang Rufus' Twitter account
- Hire Tang Rufus to build your next awesome site
Support
Love wp-admin-tabs? Help me maintain it, a donation here can help with it.
Why don't you hire me?
Ready to take freelance WordPress jobs. Contact me via the contact form here or, via email info@typist.tech
Want to help in other way? Want to be a sponsor?
Contact: Tang Rufus
Developing
To setup a developer workable version you should run these commands:
$ composer create-project --keep-vcs --no-install typisttech/wp-admin-tabs:dev-master
$ cd wp-admin-tabs
$ composer install
Running the Tests
WP Admin Tabs run tests on Codeception and relies wp-browser to provide WordPress integration. Before testing, you have to install WordPress locally and add a codeception.yml file. See *.suite.example.yml for Local by Flywheel configuration examples.
Actually run the tests:
$ composer test
We also test all PHP files against PSR-2: Coding Style Guide and part of the WordPress coding standard.
Check the code style with $ composer check-style.
Feedback
Please provide feedback! We want to make this package useful in as many projects as possible. Please submit an issue and point out what you do and don't like, or fork the project and make suggestions. No issue is too small.
Change log
Please see CHANGELOG for more information on what has changed recently.
Security
If you discover any security related issues, please email wp-admin-tabs@typist.tech instead of using the issue tracker.
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Credits
WP Admin Tabs is a Typist Tech project and maintained by Tang Rufus, freelance developer for hire.
Full list of contributors can be found here.
License
WP Admin Tabs is licensed under the GPLv2 (or later) from the Free Software Foundation. Please see License File for more information.
typisttech/wp-admin-tabs 适用场景与选型建议
typisttech/wp-admin-tabs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.5k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2017 年 10 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「wp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 typisttech/wp-admin-tabs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 typisttech/wp-admin-tabs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 typisttech/wp-admin-tabs 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
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.
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.
MIDDAG's reference architecture for a WordPress plugin — composes the OSS framework/wordpress/ui libraries end to end.
Assets helper package for the Hybrid Core framework.
统计信息
- 总下载量: 12.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 7
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: GPL-2.0
- 更新时间: 2017-10-19
