revati/packager
Composer 安装命令:
composer require revati/packager
包简介
Composer package builder template
README 文档
README
This package provides template for creating packages.
Installation
Install this package globally to access from anywhere
composer global require revati/packager=dev-master
// Update path
export PATH=~/.composer/vendor/bin:$PATH
Now you can call packager from your terminal.
First of all you have to initialize package. It will create ~/.Packager folder.
packager init
Usage
Out of the box packager does not come with any predefined templates. So you have to define them your self. To create template you have two options - generate from folder structure or fetch template config file (TODO: How to share generated template config files?).
To create template config file from directory cd in in it and run
packager template:make template-name
Now to use this template you can run
packager new my-awesome-package template-name
It will initialize package in my-awesome-package directory.
See Simple example for more detailed info.
Variables
Those variables can be used with in files and in directory and file names. Currently are supported 6 variables:
- author_name - Author name (defined with author command or on init)
- author_email - Author email (defined with author command or on init)
- package_name - Package name (first argument when creating new command)
- package_description - Package description (can be passed as option when creating package),
- package_class - Package name (in CamelCase),
- author_class - Author name (in CamelCase),
All variables are prefixed and suffixed with two underscores (that's why they are bold).
TODO
- Figure out a way to share template config files.
template:share template-namecommand to upload template config file somewhere?
- Ability to run some custom scripts (git init, composer install...) after package is initialized
- Ability to initialize package in per template predefined custom subdirectory.
- runing package initialization from project root, but create package under ./packages directory.
-
Ability to create raw template from config file, for template editing purposes. - Ability to pull composer packages, but not in vendor directory, but as main package, for editing purposes.
Simple example
Create new directory. With in it create new composer.json file.
{
"name": "__author_name__/__package_name__",
"description": "__package_description__",
"authors": [
{
"name": "__author_name__",
"email": "__author_email__"
}
],
"autoload": {
"psr-4": {
"__author_class__\\__package_class__\\": "src/"
}
},
}
Lets create src directory and with in __package_class__Class.php with fallowing content.
<?php namespace __author_class__\__package_class__;
class __package_class__Class extends SomeClass {
// Code
}
Now when template is done lets make its configuration file.
packager template:make simple-template
Template is ready. To use it run
packager new simple-package simple-template
It will create simple-package directory. It will contain composer.json file with fallowing content:
{
"name": "revati/simple-package",
"description": "",
"authors": [
{
"name": "revati",
"email": "email@email.com"
}
],
"autoload": {
"psr-4": {
"Revati\\SimplePackage\\": "src/"
}
}
}
There also will be src folder with SimplePackageClass.php file. And its content will be:
<?php namespace Revati\SimplePackage;
class SimplePackageClass extends SomeClass {
// Code
}
Hope this example helps. In Variables section you can find all available variables.
revati/packager 适用场景与选型建议
revati/packager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 revati/packager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 revati/packager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-07