Skip to content

Latest commit

 

History

History
212 lines (163 loc) · 10.7 KB

README.md

File metadata and controls

212 lines (163 loc) · 10.7 KB

WP Emerge Starter Plugin Logo

Packagist Build Gitter

A modern WordPress starter plugin which uses the WP Emerge framework.

This is the WP Emerge Starter Plugin project - for the WP Emerge framework please check out https://github.com/htmlburger/wpemerge.

Summary

Documentation

http://docs.wpemerge.com/#/starter/plugin/overview

http://docs.wpemerge.com/#/starter/plugin/quickstart

Development Team

Brought to you by Atanas Angelov and the lovely folks at htmlBurger.

Comparison Table

WP Emerge Plugin WPB WPT
View Engine PHP, Blade, Twig, any PHP PHP
Routing
WP Admin Routing
WP AJAX Routing
MVC ✖✔✔ ✖✔✖ ✖✔✖
Middleware
View Composers
Service Container
Stylesheets SASS + PostCSS CSS LESS
JavaScript ES6 Vanilla Vanilla
Hot reloading
Frontend/Admin/Any Bundle ✔✔✔ ✔✔✖¹ ✔✔✖²
Automatic Sprite Generation
Automatic Cache Busting
WPCS Linting
Advanced Error Reporting
WP Unit Tests for your classes

¹ There are prepared JavaScript files but they are not processed or transpiled in any way.

² The JavaScript files are only minified - no transpiling is done.

Email any factual inaccuracies to hi@atanas.dev so they can be corrected.

Features

  • All features from WP Emerge:
    • Named routes with custom URLs and query filters
    • Controllers
    • Middleware
    • PSR-7 Responses
    • View Composers
    • Service Container
    • Service Providers
    • PHP view layouts (a.k.a. automatic wrapping)
    • Support for PHP, Blade 5.4 and/or Twig 2 for views
  • SASS + PostCSS for stylesheets. Separate bundles are created for front-end and administration and custom bundles can be added easily.
  • ES6 for JavaScript. Separate bundles are created for front-end and administration and custom bundles can be added easily.
  • Pure Webpack to transpile and bundle assets, create sprites, optimize images etc.
  • Hot Module Replacement for synchronized browser development.
  • Autoloading for all classes in your MyApp\ namespace.
  • Automatic, fool-proof cache busting for all assets, including ones referenced in styles.
  • WPCS, JavaScript and SASS linting and fixing using a single yarn command.
  • Single-command optional CSS package installation:
    • Normalize.css
    • Boostrap 4
    • Bulma
    • Foundation
    • Tachyons
    • Tailwind CSS
    • Spectre.css
    • FontAwesome
  • WP Unit Test scaffolding for your own classes.

Non-goals

  • Taking over the WordPress main query.

    WP Emerge does not take over the main query - it actively works with it.

  • Taking over WordPress routing.

    WP Emerge does not take over WordPress' routing - it actively works with it. The only exception to this are hardcoded URLs explicitly added by a user.

  • Reinventing WordPress APIs using object-oriented interfaces.

    WP Emerge does not provide alternative APIs for registering post types, taxonomies or the like for little added benefit. Instead, it provides logical and handy places for developers to use core APIs.

  • Using a third party engine by default.

    WP Emerge uses PHP by default in the same way WordPress does but with added features. Using a third party engine is entirely optional and requires installing an extension.

  • Include most of Laravel or another framework.

    WP Emerge is lean and tuned for WordPress. While inspired by Laravel, it does not come with any illuminate/* packages. There are only 2 third party production dependencies:

    • pimple/pimple - The single-file PHP service container.
    • guzzlehttp/psr7 - A PSR-7 Request and ServerRequest implementation.

Requirements

Directory structure

wp-content/plugins/your-plugin
├── app/
│   ├── helpers/              # Helper files, add your own here as well.
│   ├── routes/               # Register your WP Emerge routes.
│   │   ├── admin.php
│   │   ├── ajax.php
│   │   └── web.php
│   ├── src/                  # PSR-4 autoloaded classes.
│   │   ├── Controllers/      # Controller classes for WP Emerge routes.
│   │   ├── Routing/          # Register your custom routing conditions etc.
│   │   ├── View/             # Register your view composers, globals etc.
│   │   ├── WordPress/        # Register post types, taxonomies, menus etc.
│   │   └── ...
│   ├── config.php            # WP Emerge configuration.
│   ├── helpers.php           # Require your helper files here.
│   ├── hooks.php             # Register your actions and filters here.
│   └── version.php           # WP Emerge version handling.
├── dist/                     # Bundles, optimized images etc.
├── languages/                # Language files.
├── resources/
│   ├── build/                # Build process configuration.
│   ├── fonts/
│   ├── images/
│   ├── scripts/
│   │   ├── admin/            # Administration scripts.
│   │   └── frontend/         # Front-end scripts.
│   ├── styles/
│   │   ├── admin/            # Administration styles.
│   │   ├── frontend/         # Front-end styles.
│   │   └── shared/           # Shared styles.
│   └── vendor/               # Any third-party, non-npm assets.
├── vendor/                   # Composer packages.
├── views/
│   ├── layouts/
│   └── partials/
├── screenshot-1.png          # Plugin screenshot.
├── wpemerge                  # WP Emerge CLI shortcut.
├── wpemerge.php              # Bootstrap plugin.
└── ...

Notable directories

app/helpers/

Add PHP helper files here. Helper files should include function definitions only. See below for information on where to put actions, filters, classes etc.

app/src/

Add PHP class files here. All clases in the MyApp\ namespace are autoloaded in accordance with PSR-4.

resources/images/

Add images for styling here. Optimized copies will be placed in dist/images/ when running the build process.

resources/styles/frontend/

Add .css and .scss files to add them to the front-end bundle. Don't forget to @import them in index.scss.

resources/styles/admin/

The admin styles directory which works identically to the resources/styles/frontend/ directory.

resources/scripts/frontend/

Add JavaScript files here to add them to the frontend bundle. The entry point is index.js.

resources/scripts/admin/

The admin scripts directory which works identically to the resources/scripts/frontend/ directory.

views/

  1. views/layouts/ - Layouts that other views extend.
  2. views/partials/ - Small snippets that are meant to be reused throughout other views.
  3. views/ - Full page views that may extend layouts and may include partials.

Avoid adding any PHP logic in any of these views, unless it pertains to layouting. Business logic should go into:

Contributing

WP Emerge Starter Plugin is completely open source and we encourage everybody to participate by: