gp

gulp-phpconfig

Gulp plugin to generate PHP configuration file.

Showing:

Popularity

Downloads/wk

8

GitHub Stars

1

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

2

Size (min+gzip)

8.3KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

gulp-phpconfig

Gulp plugin to generate PHP configuration file. The plugin reads a JSON file (e.g. .configrc) and creates a PHP file, converting JSON properties to variables or constants. You can use this plugin to switch the config file between development and production environments.

Usage

You can use just the filename as paramter or more options (See below).

var gulp = require('gulp'),
    phpConfig = require("gulp-phpconfig");

gulp.task('phpconfig-prod', function () {
    //Filename
    return gulp.src("./.prodconfigrc")
      .pipe(phpConfig('config.php'))
      .pipe(gulp.dest('./dist/config/')); // ./dist/config/config.php
});

gulp.task('phpconfig-dev', function () {
    //Options
    return gulp.src('./.devconfigrc')
      .pipe(phpConfig({ filename: 'config.php', openTag: '<?php', closeTag: '' }))
      .pipe(gulp.dest('./dev/config/')); // ./dev/config/config.php
});

Options

  • filename (String)
    • The name of PHP file (Required);
  • openTag (String)
    • The PHP open tag;
    • Default is <?php;
  • closeTag (String)
    • The PHP close tag;
    • Default is ?>;
  • define (Boolean)
    • If true the plugin will use the PHP function define(); to declare constants instead variables;
    • Default is false;

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial