Download the PHP package liqueurdetoile/wordpress-bundler without Composer

On this page you can find all versions of the php package liqueurdetoile/wordpress-bundler. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wordpress-bundler

WordpressBundler

[![Liqueur de Toile](https://hosting.liqueurdetoile.com/logo_lqdt.png "Liqueur de Toile website")](https://liqueurdetoile.com)

WordpressBundler is a wordpress project bundler written in PHP that produces clean production output. With WordpressBundler, you can easily keep all your PHP and JS code in a single repository, do your dev and, finally, creates a clean bundle that only embeds needed things for production.

Why WordpressBundler ?

In early years of PHP, all dynamic page rendering was done server side and, since there's no compiling step in PHP, the source code was also the production code.

By now, PHP and javascript are way more intricated. Moreover, dev code and dependencies are now widely spread though useless in production. On a badly configured server, they can even pose some security threats. Due to build step to bundle and optimize code, JS packages often rely on bundlers, like webpack for instance, to generate a production build.

For instance, say you're creating a wordpress plugin with scripts that needs a building step (like new Gutenberg blocks for instance). This can rapidly turn to a nightmare to organize. If you choose to have multiple repositories, you must take care of cascade updates to ensure that your plugin have the latest scripts versions. If using a monorepo, you'll embed a bunch of useless, and maybe dangerous, things in your plugin or theme. Furthermore, when using composer dependencies in a wordpress environment, you may have the wrong version loaded by another plugin and it breaks things apart.

With WordpressBundler, you can easily keep all your PHP and JS code in a single monorepository, do your dev and, finally, creates a clean bundle that only embeds production outputs.

Similarly to JS bundlers (like webpack), this tool takes care of the generation of the production version of a plugin or a theme as a folder or a ZIP archive, with or without composer dependencies bundled. It is also shipped with humbug/php-scoper great package to obfuscate dependencies namespaces and avoid conflicts.

Install the bundler

Running the bundler

With its default configuration the bundler will :

If you only need to exclude some files or folders, simply create a .wpignore file at the root of your project and add to it the patterns to exclude. The syntax is exactly the same than a .gitignore file.

This default configuration is well fitted for projects that does not require any dependencies in bundle nor relies on composer autoloader for internal purposes.

Please read about bundler configuration just below for detailed configuration settings

As a shell

There's a few options available :

Programmatically

Simply create an instance of \Lqdt\WordpressBundler\Bundler and call its bundle method. See below how to customize configuration.

Configuring bundler

Configuration files

The easiest way to tweak bundler configuration est to set up a configuration file. As default the bundler will always look first into extra.wpbundler key in project composer.json to fetch custom configuration. Alternatively, you can create an external file to store settings and calls it with --config option of the command line or, if used programmatically, with Bundler::loadConfigFile method.

To ensure config integrity, additional configuration is always merged with current one. Therefore, only updated keys of settings have to be provided.

To ease process of creating donfiguration file You can initialize a default config to be tweaked with this command :

Config file language is inferred from its extension and can be any of PHP (.php), JSON (.json), XML (.xml), INI, (.ini) or YAML (.yml). YAML requires PECL module yaml to be loaded.

Programmatic config

You can simply provide a custom configuration to bundler constructor or use Bundler::setConfig. Current configuration can be rerieved through Bundler::getConfig method.

Bundler settings

Available options for configuration with their default values are as following :

Logging

The bundler can outputs logs to console based on its parameters. It relies on laminas/laminas-log package.

If log option is set to false, no log will be outputted at all. loglevel option is following BSD syslog protocol and expects int values between 0 to 7. See Laminas log for more informations.

NOTE : You can access and change bundler logger instance programmatically through Bundler::getLogger and Bundler::setLogger methods.

Base path

Base path is used by the bundler to resolve any relative path stored in settings. Bundler base path is automatically set to current project root folder that will fit most of use cases.

If needed, you can specify a different base path for the bundler. If a relative path is provided, it will be resolved from project root folder.

Finder

The bundler embeds symfony/finder package to analyze filesystem and extract entries to be bundled. With default settings, all files and folders located in bundler base path will be integrated into the bundle, except VCS own and ignored files and folders.

Available settings under findersettings key are :

I deliberately limit depth to 0 in order to speed up things as copying a whole folder is way more quicker than copying each of its files and subfolders. See Speeding up bundling for more informations.

The actual options can handle 99% of needs but there's some limitations as Finder Component cannot exclude files based on path for instance. Please refer to component own documentation for more details.

NOTE : You can access and change bundler finder instance programmatically through Bundler::getFinder and Bundler::setFinder methods.

Composer

You can tell bundler to perform a clean install before bundling to embeds dependencies in final bundle and allow use of Composer autoloader. If you're using external dependencies, it is recommended to also use PHP-Scoper to avoid conflicts of package versions between plugins or themes in a wordpress deployment.

Available settings under composer settings key are :

PHP-Scoper

The package humbug/php-scoper provides a convenient way to avoid conflicts of package versions between plugins or themes in a wordpress deployment. It will update all namespaces and bundler will take care of updating autoloader.

If you want to use a custom configuration you can create a scoper.inc.php file in bundler base path that will be automatically loaded.

Output and temporary folders

Available settings are :

Speeding up bundling

There's a few things you can do to improve the bundling speed :

  1. Keep your files well structured in order to handle filtering patterns at root level only. Copying whole folders are way more faster than processing each nested files
  2. If you're not using composer autoloader, check that install step is disabled by setting composer.install to false and filter out any composer/dev files and folders
  3. If you're only using your own package and namespace and ensuring it won't conflict with others (with vendor prefix for instance), there's no need to use php-scoper

Contributing or reporting bugs

WordpressBundler is welcoming any contribution and related PRs. Pleasy follow the contributing guidelines to do so.

Any bug or suggestion should be made in this repository issues tracker.

Changelog

What's next ?

There's many things that can be done to improve Wordpress Bundler. For instance, add a check command to verify if a pattern is found or not based on bundler configuration.

Feel free to suggest improvements and/or submit PRs !


All versions of wordpress-bundler with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
symfony/console Version ^5.4
symfony/filesystem Version ^5.4|^6.3
adbario/php-dot-notation Version ^3.1
mindplay/composer-locator Version ^2.1
laminas/laminas-log Version ^2.15
humbug/php-scoper Version ^0.17|^0.18.4
nelexa/zip Version ^4.0
symfony/finder Version ^5.4|^6.3
laminas/laminas-config Version ^3.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package liqueurdetoile/wordpress-bundler contains the following files

Loading the files please wait ....