定制 3ev/phingy 二次开发

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

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

3ev/phingy

最新稳定版本:v4.0.0

Composer 安装命令:

composer require 3ev/phingy

包简介

A useful collection of build scripts for managing PHP sites

README 文档

README

#Phingy

Phingy is a small collection of build scripts which you can mix together differently depending on your project. To use these scripts, you include the required ones in your build script starting with your own project.xml.

###Installation & dependencies

Phingy is installed via Composer. Add the following to your project's composer.json and run composer install:

{
    "require": {
        "3ev/phingy": "~4.0"
    },
    "scripts": {
        "post-install-cmd": [
            "Tev\\Phingy\\ComposerScripts::postInstall"
        ]
    },
    "config": {
        "bin-dir": "bin"
    }
}

You'll then be able to run Phing using

$ bin/phing

###'Skel' files

Phingy will automatically generate files from .skel files anywhere in your project. These files can include Phing properties which will be replaced with their actual values at compile time.

You may for example want to create an Apache vhost config file for your project, which you'll be able to commit to source control without having to including any environment specific config. Like so:

# In config/httpd.conf.skel

<VirtualHost *:80>
    ServerName ${build.url}
    DocumentRoot ${build.public_dir}
</VirtualHost>

###Database tasks & S3

If you'd like to make use of the database tasks that push/pull database dumps from Amazon S3, you will need to install the Pear Amazon S3 package:

$ pear install Services_Amazon_S3

This will allow you to backup and download your full database to/from S3 using:

$ bin/phing db:commit
$ bin/phing db:update

There are numerous other database tasks that make it easy to configure a MySQL database for your project.

###Setting up a webserver

Phingy includes a build:server task which will by default configure and install Apache configuration for your project.

Config will be symlinked from config/httpd.conf to /etc/apache2/sites-enabled, so you can commit a file to version control (or use a .skel extension) and simply run

$ sudo bin/phing build:server

to start your project running on Apache.

###Platform specific tasks

Phingy includes a few 'platform' specifc task sets, as followss:

  • typo3 Typo3 specific tasks (includes db). Will set up TYPO3 on build, and provides some utility methods.
  • sphinx Sphinx specific tasks. Provides tasks to index Sphinx data for the project.
  • laravel Laravel specific tasks. Provides tasks to work with the Laravel framework

###Setting up your project with Platforms

When you run composer install, you will be prompted to pick a template to use for your project. Selecting a template will create a file called project.xml in your project's config/ directory.

The project.xml file includes a number of hooks you can add to for project-specific tasks. Currently, These are:

project:config                Configure extra properties to use in your build
project:build:before          Run some tasks before `build`
project:build:after           Run some tasks after `build`
project:build:housekeeping    Cleanup any uneeded files or data

Each platform includes each of these hooks as well, of the form [platform]:build:before etc. If you'd like to make use of a platform, simply include it with:

<import file="${phingy.path}/scripts/platform/[platform].xml" />

and then call each of its hooks in your project-specific hooks:

<target name="project:build:before">
    <phingcall target="[platform]:build:before" />
</target>

Note: If you pick a non-default template (like 'typo3'), all of this will be handled for you.

###Adding your own project specific tasks and config

You can add any of your own tasks in config/project.xml. These should be namespaced with project: for convention. You can either add standalone tasks, or call them in any of the available hooks.

###Overriding existing tasks

If you need to, you can override built in tasks by creating a new task with the same name in your project.xml. You shouldn't have to do this though, as the built in hooks provide enough flexibility for you to customise tasks.

###Adding extra config

You add should any project specific config to config/project.properties if possible. If you need to prompt the user for it during build, you can do so in the project:config hook.

###About ./build.xml

build.xml sits in the root of your project, and is symlinked from vendor/. You should add this file to your .gitignore.

统计信息

  • 总下载量: 8.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 8
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-10-27