suomato/luna
Composer 安装命令:
composer require suomato/luna
包简介
Command-line interface for Base Camp theme
README 文档
README
Command-line interface for Base Camp theme.
Commands
Make Custom Post Type
This Command helps you to create a new Custom Post Type very fast.
php luna make:custom-post-type {name}
The argument is singular form. if noun have irregular plural which do not behave in standard way(singular+s), exception can be defined by plural option e.g.
php luna make:custom-post-type person --plural=people
The new file is created to
/app/config/wp/custom-post-types/{name}.php
Make Custom Taxonomy
This Command helps you to create a new Custom Taxonomy very fast.
php luna make:custom-taxonomy {name}
The argument is singular form. if noun have irregular plural which do not behave in standard way(singular+s), exception can be defined by plural option e.g.
php luna make:custom-taxonomy country --plural=countries
The new file is created to
/app/config/wp/custom-taxonomies/{name}.php
Make Route
This Command helps you to create a new route for WordPress API clearer and faster way.
php luna make:route {name}
The new file is created to
/app/config/wp/routes/{name}.php. The created file comes with the well documented boilerplate.
Make Shortcode
This Command helps you to create a new shortcode with very clean boilerplate.
php luna make:shortcode {name}
The new file is created to
/app/config/wp/shortcodes/{name}.php.
Example
Run command:
php luna make:shortcode LuckyNumber
Then define some data
/**
* @var string Shortcode name
*/
protected $shortcode = 'lucky_number';
/**
* @var array|string An associative array of attributes
*/
protected $attributes = [
'number' => 7,
];
/**
* Return template of shortcode
*
* @param $attr An associative array of attributes
* @param $content Enclosed content
*
* @return mixed
*/
protected function template($attr, $content)
{
return 'This is my lucky number: ' . $attr['number'];
}
Now shortcode
[lucky_number]generatesThis is my lucky number: 7and[lucky_number number="13"]generatesThis is my lucky number: 13
It is also possible to use power of Timber. In template function you can return Timber view instead of string like this:
// resources/views/shortcodes/lucky-number.twig
<p>This is my lucky number: {{ number }}</p>
******************************************************************
// app/config/wp/shortcodes/LuckyNumber.php
protected function template($attr, $content)
{
return \Timber::compile('shortcodes/lucky-number.twig', $attr);
}
Make Menu Page
This Command helps you to create a new Menu Page or Submenu Page to wp-admin navigation.
php luna make:menu-page {name}
This command will create a new MenuPage class in
/app/config/wp/menu-pages/{name}.php. The generated file will include the Menu Page properties. Submenu Page could be created by:
php luna make:menu-page {name} --submenu
A new SubMenuPage class will be generated in
/app/config/wp/submenu-pages/{name}.php
suomato/luna 适用场景与选型建议
suomato/luna 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.16k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 09 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 suomato/luna 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 suomato/luna 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-09-13