1.0.4 • Published 4 years ago

sync-php v1.0.4

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

this is a webpack plugin that you can use to reload php files on changes.

Installation

step 1

add plugin to the webapck.dev.config.js array

const syncPhp = require('sync-php');

plugins: [
    new syncPhp({
        port: 1337, // required
        watch: path.resolve('build/') // required
    })
]

there are two options

port

  • use the port seprate from all the other ports

watch

  • directory you want to wath changes

step 2

add loader to your main.js file at the end

require('sync-php/client.js')(1337) 
// this is the same port mentioned above

both ports should be same

step 3

run wepack server in watch mode or run dev server open your php file into browser

for php server use following command

php -S localhost:9000