rickysu/php-livereload 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rickysu/php-livereload

最新稳定版本:v0.1.2

Composer 安装命令:

composer require rickysu/php-livereload

包简介

a livereload server implement by php

README 文档

README

Build Status Coverage Status

php-livereload is a livereload server written in PHP.

php-livereload uses livereload.js -- a JavaScript file implementing the client side of the LiveReload protocol.

Install

Install php-livereload from composer.

{
    "require": {
        "rickysu/php-livereload": "dev-master"
    }
}

Get the command-line php-livereload

$ curl -O https://raw.github.com/RickySu/php-livereload/master/dist/reload.phar
$ chmod +x reload.phar
$ sudo mv reload.phar /usr/bin

Install LiveReload Safari/Chrome/Firefox extension

Tests

To run the test suite, you need install the dependencies via composer, then run PHPUnit.

$ composer install
$ phpunit

Using php-livereload

define a livereload.json in your project root.

livereload.json

{
    "period": 1,
    "watch": {
        "web/css/":   "*.css",
        "web/js/":    "*.js",
        "web/img/":   "\\.png|gif|jpg$"
    }
}
  • period: monitor file changes every 1 second.
  • watch: file and folder you want to watch

Initialize a default livereload.json file.

$ php bin/reload livereload:init

Running Server.

$ php bin/reload server:run

Rolling Your Own Live Reload

If you would like to trigger the live reload server yourself, simply POST files to the URL: http://localhost:35729/changed. Or if you rather roll your own live reload implementation use the following example:

# notify a single change
curl http://localhost:35729/changed?files=style.css

# notify using a longer path
curl http://localhost:35729/changed?files=js/app.js

# notify multiple changes, comma or space delimited
curl http://localhost:35729/changed?files=index.html,style.css,docs/docco.css

Or you can bulk the information into a POST request, with body as a JSON array of files.

curl -X POST http://localhost:35729/changed -d '{ "files": ["style.css", "app.js"] }'

# from a JSON file
node -pe 'JSON.stringify({ files: ["some.css", "files.css"] })' > files.json
curl -X POST -d @files.json http://localhost:35729

License

MIT, see LICENSE.

统计信息

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

GitHub 信息

  • Stars: 75
  • Watchers: 2
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-05