PHPackages                             orkan/wp-base - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. orkan/wp-base

ActiveLibrary[Framework](/categories/framework)

orkan/wp-base
=============

Wordpress plugin: WP Base

3.0.0(1y ago)0161MITPHP

Since May 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/orkan/wp-base)[ Packagist](https://packagist.org/packages/orkan/wp-base)[ Docs](https://github.com/orkan/wp-base)[ RSS](/packages/orkan-wp-base/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (6)Used By (1)

WordPress plugin boilerplate `v3.0.0`
=====================================

[](#wordpress-plugin-boilerplate-v300)

Extendable PHP classes for easy customization.

Out-of-the-box:
---------------

[](#out-of-the-box)

- Dashboard: Settings and Tools pages (unlimited)
- Custom DB cache
- Ajax requests support
- Custom admin Notices and Transients
- CSS/JS assets: combine from partials, build, minify &amp; enqueue

Introduction:
-------------

[](#introduction)

This package was made to provide a foundation to create your own WordPress plugin with a basic functionality already implemented, like the Settings page or DB cache supprort.

This package will install in Composer \[vendor\] dir, making it inaccessible from WordPress installation. You must create your own folder in WP \[plugins\] dir and extend only those classes you will need in your project. A working example of such plugin can be found here: [Base1](https://github.com/orkan/wp-base1)

Create plugin:
--------------

[](#create-plugin)

Create your plugin entry point file `[WP]/wp-content/plugins/[your_plugin]/plugin.php`then `run()` only the necessary parts:

```
namespace My\Name;
/*
 * Plugin Name: My plugin
 */
$Factory = new Factory();
$Factory->Plugin()->run();
$Factory->Settings()->run();
```

Tools:
------

[](#tools)

The [Base1](https://github.com/orkan/wp-base1) package comes with some example Tools and their CSS/JS assets (`/assets` dir) and FORM input definitions ( `/config` dir). The included Tools are:

```
$Factory->Mailer()->run(); // Example with WP Mail form
$Factory->Formix()->run(); // Example how to create custom FORM with various inputs
$Factory->Ajaxer()->run(); // Example how to handle Ajax requests
```

Links to these Tools will be automatically displayed in the: Dashboard &gt; Plugins &gt; My Plugin - meta row.

CSS/JS assets:
--------------

[](#cssjs-assets)

The example CSS/JS assets are pre-build and minified, but you can modify them and re-build on each page refresh by adding these constants to `wp-config.php` file:

```
define( 'ORK_ASSET_REBUILD_CSS', true );
define( 'ORK_ASSET_REBUILD_JS', true );
define( 'ORK_ASSET_MINIFY_CSS', true );
define( 'ORK_ASSET_MINIFY_JS', true );
```

Another way to rebuild assets is by using a Composer script command: `composer run rebuildOrkWpBaseAssets` described in next section.

Composer:
---------

[](#composer)

Composer is required to install this plugin and all its dependencies and also to support autoloading class files. This README assumes following directory structure in your Composer/WordPress installation:

```
/htdocs
  |- /html
