2017 © Pedro Peláez
 

symfony-bundle livephp-bundle

LivePHP Bundle for Symfony2

image

mbence/livephp-bundle

LivePHP Bundle for Symfony2

  • Monday, May 20, 2013
  • by mbence
  • Repository
  • 0 Watchers
  • 0 Stars
  • 109 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

LivePHPBundle for Symfony

LivePHP will save developers time by automatically refreshing the browser when a file is changed in the working directory., (*1)

Description

This bundle was written to make developers' life easier. Inspired by the brilliant live.js (written by Martin Kool), this script will auto refresh your browser if you change any files in your working directory. No need for Alt-Tab and manual refresh anymore., (*2)

With this script, it is also very easy to check your work in many browsers simultaneously. Just load the site in all your browsers or devices and the rest goes automatically., (*3)

WARNING!, (*4)

You should never activate this on a live server! It is meant for developer environment only!, (*5)

Prerequisites

This bundle requires Symfony2., (*6)

Installation

Step 1: Download the bundle using composer

Add the following in your composer.json:, (*7)

{
    "require": {
        "mbence/livephp-bundle": "dev-master"
    }
}

Then download / update by running the command:, (*8)

``` bash $ php composer.phar update mbence/livephp-bundle, (*9)


Composer will install the bundle to your project's `vendor/mbence/livephp-bundle` directory. ### Step 2: Enable the bundle in your AppKernel It is strongly recommended that you never use this script on a live site, so it's best to add the bundle only for the dev environment. ``` php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... ); if ('dev' == $this->getEnvironment()) { $bundles[] = new MBence\LivePHPBundle\LivePHPBundle(); } }

Step 3: Import LivePHP routing files

Add this to your routing_dev.yml file: ``` yaml, (*10)

app/config/routing_dev.yml

livephp_monitor: resource: "@LivePHPBundle/Resources/config/routing.yml", (*11)


### Step 4: Include the livephp.js in your templates Livephp.js must be loaded on every page you want to work with, so a layout template file is a good place to add the following: ``` twig {% block javascripts %} {% if app.environment == 'dev' %} <script src="{{ asset('/bundles/livephp/js/livephp.js') }}" type="text/javascript"></script> {% endif %} {% endblock %}

Now LivePHP is ready. You can open one of your pages in a browser and if you edit and save a file in your project, the browser will automatically refresh and show the new contents.

Optional Steps

Configure LivePHP

You can set many options in LivePHP, including what directories to monitor or ignore, by adding the following configuration to your config_dev.yml: ``` yaml, (*12)

app/config/config_dev.yml

live_php: dirs: [., ../src, ../web] ignore: [logs, cache] timelimit: 125 cssonthefly: true, (*13)

By default LivePHP will monitor the `app`, `src` and `web` directories and it will ignore the `logs` and `cache` directories.
You can also set the time limit - how long a monitor worker should run in the background. Default is 125 sec. LivePHP will try to use this value,
but if it cant set the timeout for some reason it will fall back to your servers settings, and work just fine.
New feature since v1.2: With the `cssonthefly` you can enable or disable css refresh without reloading the page. By default this is enabled.


### If your app requires authentication, you should add LivePHP to your firewall rules:

``` yaml
# app/config/security.yml
    access_control:
        - { path: ^/livephpmonitor, role: IS_AUTHENTICATED_ANONYMOUSLY }

The front controller name in js

The app_dev.php front controller is hardcoded in livephp.js. If you use a different filename, you should update it in the line 17: javascript // Resources/public/js/livephp.js init: function() { // the url for the monitor (with the front controller) LivePhp.url = '/app_dev.php/livephpmonitor'; //..., (*14)

The Versions

20/05 2013

dev-master

9999999-dev https://github.com/mbence/LivePHPBundle

LivePHP Bundle for Symfony2

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

symfony refresh autorefresh

29/04 2013

v1.2

1.2.0.0 https://github.com/mbence/LivePHPBundle

LivePHP Bundle for Symfony2

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

symfony refresh autorefresh