Skip to content
This repository has been archived by the owner. It is now read-only.
raw loader module for webpack
Branch: master
Clone or download
Pull request Compare This branch is 23 commits ahead, 32 commits behind webpack-contrib:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Skip node modules Mar 26, 2016
README.md Update README.md Nov 2, 2017
index.js Updated for Compatibility with Webpack 2 Jul 17, 2017
package.json Need glob for dependancy checking Jul 13, 2016

README.md

php loader for webpack

This package will load any php content and use php to turn it into a html page.

Ex:

Installation

npm install php-loader

Usage

var fileContent = require("php!./file.php");
// => run file.php with php and return it as some content (html for example)

It can also be used inside the webpack configuration file (webpack.js):

module.exports = {
  ...
  module: {
    loaders: [
      ...
      {
        test: /\.php$/,
        loaders: [
          'html-minify',
          'php-loader'
        ]
      },
      ...
    ]
  },
  ...
}

Documentation: Using loaders

Configuration

Here is a list of the available configuration options:

  • proxy: set the name of a proxy script to be used as a loader for the resource
  • args: list of string to be added as arguments to the proxy (or php) script
  • dependancies: list of glob pattern of files on which the resource depend
  • debug: add depandancies as html comment in the output (this will modify the output of the php script, and can lead to invalid results)

example usage:

         loaders: [
          'php-loader?' + JSON.stringify({
            proxy: 'router.php',
            args: [ '--arg1=no' ],
            dependancies: [
              __dirname + '/www/api/v1.0/app/**/*.php',
              __dirname + '/www/templates/**/*.php'
            ],
            debug: true
          })
        ]

In this case, the command to be executed by php-loader to get the file 'resource.php' will be:

  php router.php --arg1=no resource.php

Thanks

Thanks to #fullsteamlabs to fix compatibility issue with webpack 2.

License

MIT (http://www.opensource.org/licenses/mit-license.php)

You can’t perform that action at this time.