Download the PHP package wpstrap/wordpress-plugin-boilerplate without Composer

On this page you can find all versions of the php package wpstrap/wordpress-plugin-boilerplate. 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-plugin-boilerplate

WordPress Plugin Boilerplate

Build Status PHP 7.1+

Plugin boilerplate with modern tools to kickstart your WordPress project
This includes common and modern tools to facilitate plugin development and testing with an organized, object-oriented structure and kick-start a build-workflow for your WordPress plugins.

Quickstart

Image

Should be run inside your plugins folder (wp-content/plugins).

You can also use the npx script with predefined answers to get a quicker start

It will take a couple of minutes to install after your terminal input; it will clone the git repo's, search and replace all the plugin data, do a composer install, and when it's combined with the Webpack workflow then it wil also do a npm install

Read more about the configuration & build scripts

Features & benefits

Backend

Composer (Namespaces + PSR4 autoloader + Dependency manager)

  • Namespace support to group all of your code under a custom name. That way, your classes, functions, and so on don’t clash with other people’s code running on the site at the same time
  • PSR-4 Autoloader to autoload files and directories in connection with namespaces
  • Includes a dependency manager to easily load in 3rd party libraries from packagist, locked onto specific versions

Object-oriented & classes autoloader

PHPCodeSniffer + WordPress Coding Standards + Automattic's phpcs-neutron-ruleset

  • PHP CodeSniffer is built in with predefined configuration for proper linting. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
  • PHPCS is extended with the WordPress Coding Standards & PHPCompatibilityWP for PHP_CodeSniffer which is a collection of PHP_CodeSniffer rules (sniffs) to validate code developed for WordPress. It ensures code quality and adherence to coding conventions, especially the official WordPress Coding Standards.
  • PHPCS is also extented with Automattic's phpcs-neutron-ruleset which is a set of modern (PHP >7) linting guidelines for WordPress development.

Codeception (unit/acceptance testing)

  • Codeception is built in which combines all testing levels (acceptance, functional, integration, unit) with WordPress defined functions, constants, classes and methods in any test.
  • With a flexible set of included modules, tests are easy to write, easy to use, and easy to maintain.

Plugin requirements

  • Requirements micropackage is built in that allows you to test environment requirements to run your plugin. It can test: PHP version, PHP Extensions, WordPress version, Active plugins, Current theme, DocHooks support
  • Easily to configure using a simple array
  • If the plugin doesn't pass the test then it will disable the plugin automatically for the user in WordPress and show a notification in the back-end

TravisCI

  • Ready to use TravisCI configuration for automatic testing & continuous integration which currently only validates the plugin code with PHPCodeSniffer during automated testing when being deployed, but can also be extended to test unit/acceptance cases from Codeception

Prettified errors & Classes debug array

Frontend (Webpack)

For front-end tooling the webpack workflow is being cloned. Read more about this workflow here: https://github.com/wp-strap/wordpress-webpack-workflow

Styling (CSS)

  • Minification in production mode handled by Webpack
  • PostCSS for handy tools during post CSS transformation using Webpack's PostCSS-loader
  • Auto-prefixing using PostCSS's autoprefixer to parse CSS and add vendor prefixes to CSS rules using values from Can I Use. It is recommended by Google and used in Twitter and Alibaba.
  • PurgeCSS which scans your php (template) files to remove unused selectors from your css when in production mode, resulting in smaller css files.
  • Sourcemaps generation for debugging purposes with various styles of source mapping handled by WebPack
  • Stylelint that helps you avoid errors and enforce conventions in your styles. It includes a linting tool for Sass.

Styling when using PostCSS-only

  • Includes postcss-import to consume local files, node modules or web_modules with the @import statement
  • Includes postcss-import-ext-glob that extends postcss-import path resolver to allow glob usage as a path
  • Includes postcss-nested to unwrap nested rules like how Sass does it.
  • Includes postcss-nested-ancestors that introduces ^& selector which let you reference any parent ancestor selector with an easy and customizable interface
  • Includes postcss-advanced-variables that lets you use Sass-like variables, conditionals, and iterators in CSS.

Styling when using Sass+PostCSS

JavaScript

  • BabelJS Webpack loader to use next generation Javascript with a BabelJS Configuration file
  • Minification in production mode
  • Code Splitting, being able to structure JavaScript code into modules & bundles
  • Sourcemaps generation for debugging purposes with various styles of source mapping handled by WebPack
  • ESLint find and fix problems in your JavaScript code with a linting configuration including configurations and custom rules for WordPress development.
  • Prettier for automatic JavaScript / TypeScript code formatting

Images

Translation

  • WP-Pot scans all the files and generates .pot file automatically for i18n and l10n

BrowserSync, Watcher & WebpackBar

  • Watch Mode, watches for changes in files to recompile
  • File types: .css, .html, .php, .js
  • BrowserSync, synchronising browsers, URLs, interactions and code changes across devices and automatically refreshes all the browsers on all devices on changes
  • WebPackBar so you can get a real progress bar while development which also includes a profiler

Configuration

  • All configuration files .prettierrc.js, .eslintrc.js, .stylelintrc.js, babel.config.js, postcss.config.js are organised in a single folder
  • The Webpack configuration is divided into 2 environmental config files for the development and production build/environment

Requirements

File structure

You can add your own new class files by naming them correctly and putting the files in the most appropriate location, see other files for examples. Composer's Autoloader and the Bootstrap class will auto include your file and instantiate the class. The idea of this organisation is to be more conscious of structuring your code.

What to configure

  1. When using codeception; configure the environments settings in .env.testing, other configurations can be found in codeception.dist.yml
  2. When using Webpack; edit the BrowserSync settings in webpack.config.js which applies to your local/server environment
    • You can also disable BrowserSync, Eslint & Stylelint in webpack.config.js
    • You may want to configure the files in /webpack/ and webpack.config.js to better suite your needs
  3. You can activate the plugin in WordPress and work on it straight away.

Acceptance & Unit Testing

PHPCodeSniffer

Plugin requirements

TravisCI

Frontend/Webpack tooling

When using webpack then you can use the following for the front-end build process. Read here more for more information about this workflow.

Developing Locally

To work on the project locally (with Eslint, Stylelint & Prettier active), run:

Or run with watcher & browserSync

This will open a browser, watch all files (php, scss, js, etc) and reload the browser when you press save.

Building for Production

To create an optimized production build (purged with PurgeCSS & fully minified CSS & JS files), run:

Or run with watcher & browserSync

More Scripts/Tasks

Composer.json dependencies

Depedency Description Version
Plugin Requirements
micropackage/requirements Allows you to test environment requirements to run your plugin. 1.0
PHPCodeSniffer
dealerdirect/phpcodesniffer-composer-installer Allows for easy installation of PHP_CodeSniffer coding standards (rulesets) 0.7.1
wp-coding-standards/wpcs Collection of PHP_CodeSniffer rules (sniffs) to validate code developed for WordPress *
automattic/phpcs-neutron-ruleset Set of modern (PHP >7) linting guidelines for WordPress development 3.3
phpcompatibility/phpcompatibility-wp Analyse the codebase of a WordPress-based project for PHP cross-version compatibility 2.1
Codeception
lucatume/function-mocker A Patchwork powered function mocker to mock function for testing 1.0
lucatume/wp-browser Provides easy acceptance, functional, integration and unit testing for WordPress plugins, themes and whole sites using Codeception 3.0
Codeception/lib-innerbrowser Parent library for all Codeception framework modules and PhpBrowser. 1.0
codeception/module-asserts A Codeception module containing various assertions 1.0
codeception/module-phpbrowser Use to perform web acceptance tests with non-javascript browser 1.0
codeception/module-webdriver Run tests in real browsers using the W3C WebDriver protocol. 1.0
codeception/module-db A database module for Codeception. 1.0
codeception/module-filesystem A Codeception module for testing local filesystem. 1.0
codeception/module-cli A Codeception module for testing basic shell commands and shell output. 1.0
codeception/module-rest A REST module for Codeception 1.2
codeception/util-universalframework Mock framework module used in internal Codeception tests 1.0
codeception/codeception-progress-reporter Reporter for codeception with a progress bar 4.0.2

Package.json dependencies

https://github.com/wp-strap/wordpress-webpack-workflow#packagejson-dependencies

Boilerplate's Changelog

Documenting this project's progress...

January 15, 2021


All versions of wordpress-plugin-boilerplate with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
micropackage/requirements Version ^1.0
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 wpstrap/wordpress-plugin-boilerplate contains the following files

Loading the files please wait ....