Giter Club home page Giter Club logo

wpkickstart's Introduction

wpkickstart

A great way to kickstart a new WordPress plugin or project.


Built and tested for PHP 5.6.20 through 7.2.0.

Installation โ†’

Get more information on the Wiki โ†’


Changelog

2.0.0

This release introduces a new concept that introduces mobility of things you build. It separates out services (think of these as features) and components (think of these as reusable things services use to do things) into services/ and components/.

The idea is that a service or a component (really just a folder of files) can have it's own classes, Javascripts, CSS, etc and each can move to other wpkickstart frameworks by moving their folder into the other one with minor code changes for it to work.

This should make the things you build in wpkickstart easily re-usable in other projects built on wpkickstart.

  • New Services and Components architecture (note component namespace changes)
  • wp CLI replacements, see wp kickstart build after you activate wpkickstart to set it up for your specific project
  • Easier wp based install, see Installation
  • More class flexibility (now if you new Anything() it will automatically autoload class-anything.php no matter where you put it)

Backwards Compatibility

2.0.0 is somewhat backwards compatible with later versions, but you may have to group your classes that used to be in includes/ with a component or a service.


1.2

This minor release fixes a major issue with $app being in the global space and conflicts with other plugins using the same architecture. #5

1.1

This is based off of some of 1.0's uses in different projects and has been improved to be more stable!

  • Added App::version() and App::header() methods for easy access to version and header information
  • Added Grunt for easy .pot file creation, etc
  • Adds App->wp-debug for easy WP_DEBUG detection
  • Uses App::attach() method to attach new classes (must add manually)
  • Uses App::hooks() method to run hooks when WP is ready (must add manually)
  • Adds better app() callback and global $app that can alternatively be called using global $app
  • Hardened phpunit testing for a good starting point for how the framework should work, you should be able to add additional tests with ease

1.0

This came directly from a breakdown of the WDS SSO plugin that used my app framework. It does not work perfectly and has issues that could be problematic, so please use a future version.

wpkickstart's People

Contributors

aubreypwd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

wpkickstart's Issues

Upon first use, got this issue

[14-Oct-2017 19:23:43 UTC] PHP Fatal error:  Uncaught Error: Class 'aubreypwd\CampDavid\Shared' not found in /app/public/wp-content/plugins/camp-david/includes/class-app.php:132
Stack trace:
#0 /app/public/wp-content/plugins/camp-david/includes/class-app.php(76): aubreypwd\CampDavid\App->attach()
#1 /app/public/wp-content/plugins/camp-david/camp-david.php(42): aubreypwd\CampDavid\App->__construct('/app/public/wp-...')
#2 /app/public/wp-content/plugins/camp-david/camp-david.php(59): aubreypwd\CampDavid\app()
#3 /app/public/wp-admin/includes/plugin.php(560): include_once('/app/public/wp-...')
#4 /app/public/wp-admin/plugins.php(42): activate_plugin('camp-david/camp...', 'http://campdavi...', false)
#5 {main}
  thrown in /app/public/wp-content/plugins/camp-david/includes/class-app.php on line 132
[14-Oct-2017 19:23:43 UTC] PHP Fatal error:  Uncaught Error: Class 'aubreypwd\CampDavid\Shared' not found in /app/public/wp-content/plugins/camp-david/includes/class-app.php:132
Stack trace:
#0 /app/public/wp-content/plugins/camp-david/includes/class-app.php(76): aubreypwd\CampDavid\App->attach()
#1 /app/public/wp-content/plugins/camp-david/camp-david.php(42): aubreypwd\CampDavid\App->__construct('/app/public/wp-...')
#2 /app/public/wp-content/plugins/camp-david/camp-david.php(59): aubreypwd\CampDavid\app()
#3 /app/public/wp-admin/includes/plugin.php(1882): include('/app/public/wp-...')
#4 /app/public/wp-admin/plugins.php(164): plugin_sandbox_scrape('camp-david/camp...')
#5 {main}
  thrown in /app/public/wp-content/plugins/camp-david/includes/class-app.php on line 132
[14-Oct-2017 19:23:43 UTC] PHP Fatal error:  Uncaught Error: Class 'aubreypwd\CampDavid\Shared' not found in /app/public/wp-content/plugins/camp-david/includes/class-app.php:132
Stack trace:
#0 /app/public/wp-content/plugins/camp-david/includes/class-app.php(76): aubreypwd\CampDavid\App->attach()
#1 /app/public/wp-content/plugins/camp-david/camp-david.php(42): aubreypwd\CampDavid\App->__construct('/app/public/wp-...')
#2 /app/public/wp-content/plugins/camp-david/camp-david.php(59): aubreypwd\CampDavid\app()
#3 /app/public/wp-admin/includes/plugin.php(1882): include('/app/public/wp-...')
#4 /app/public/wp-admin/plugins.php(164): plugin_sandbox_scrape('camp-david/camp...')
#5 {main}
  thrown in /app/public/wp-content/plugins/camp-david/includes/class-app.php on line 132

Components should be individual packages.

Right now we load a component library, let's work on making components individually installable. But also make the wpkickstart-components just be an easy JSON library of where they are?

Rename includes to app/

The includes/ folder in this structure really only have to do with the App now. We need to also make this backwards compatible a bit, so that we still load includes (enhance autoloader more lol).

$app cannot be called that, it must be unique since it's global variable.

https://github.com/aubreypwd/wp-plugin-boilerplate/blob/master/plugin-name.php#L24

Putting $app out in the global space does in fact make it global (not to the namespace). What that ends up doing is colliding with other plugins built on this structure. It needs to go in a static variable in the app() function. Or, it needs to be unique.

The second task above is so that you can use the below method to get to the app object:

global $app;
$app->thing->action();

allow new Class() anywhere

The autoloader needs to be even smarter.

If I make a e.g. new Class() that isn't attached to App I should be able to do it. Only detected feature classes and detected includes (which usually only have to do with the app infrastructure) are autoloaded from App.

Better composer integration

Right now all composer packages are installed in /vendor. But features can have their own composer package dependancies and those don't need to go in /vendor at the root. E.g.:

In this example one of the features has it's own composer dependances.

Let's make sure the root composer.json also installs those by looping through the folders looking for composer.json and running pre/post install/update commands in those folders too.

Re-work to be component/feature organized

This was an idea given to me by a coworker, e.g.:

  • feature-name/
    • assets/
      • js/
      • css/
    • class-feature-name.php
    • vendor/

The idea is that the folder feature-name could be moved around to other plugins using this same platform. E.g. bug-spray could be easily added to another project just by copying the folder (which has all it's things) to the plugin on another projects and loaded into the class-app.php and run it's hooks/etc.

Maybe hooks could be auto loaded now which would do all the things.

Check tests

With 2.2.0 and all the things we've done tests may not be working, let's beef those up!

Allow multiple word classes with a -

class-app.php#L112

Here, if you create a class like, Edit_Posts you have to create a file like class-edit_posts.php which should be class-edit-posts.php.

$file = 'class-' . strtolower( str_replace( '_', '-', end( $parts ) ) ) . '.php';

...is better.

Add SASS Support

I, simply, should be able to write SASS. And when I save it a .css version of it is made so I can enque it.

Keep all WIKI documentation in /docs

I think this would just be a sub-module for the wiki?

Idea 1

  • Move all documentation to wiki
  • Maybe (if we can) make wiki composer installable
  • Commit the docs to the repo if we can
  • Add documentation to update docs with composer update

Consider PSR4

On a call today with @jrfoell and @efuller they said they'd like to see what this would look like if it used a standards PSR4-ish autoloader.

Add autorun feature

Classes in features/ should have a run method. The App class should run these automatically when they are attached to the base app.

Add wpcli commands for replacements

I don't know if cli does an interactive mode, but would be cool to install the plugin, activate it (as is), and run wp kickstart and it start asking you for replacements to make.

  • Add the cli command
  • Update documentation
  • Remove old replace.php method

Separate components from service/features

The way you are supposed to build features/components out is that each component should work somewhat independent of one another. Pulling in another component into another creates a dependencies between the two.

So the way I've been doing it is that there is always a conductor of sorts that connects all the components together and is usually the base feature class that does it, and this is usually what builds out the main feature of the component....

E.g. in a component called example it's class-example.php that does the conducting and uses the various other components creating a dependency with most other components.

All this said, I'd like a way to identify it as so somehow. Idea(s):

  • You create a component called components/conductor/class-conductor.php

The attachment would look like:

new Conductor()

This doesn't make sense actually because you could have many conductors, maybe we do:

  • You have both components/ and features/ folders. features/ do the conducting (maybe name conductors/?) and use the components/ which have less dependencies.

I LIKE THIS!

Will have impact on #7

Add ES6 Support

Writing ES6 takes a great deal of work to get it to work in ES5 browers, etc. I know there are ways to write ES6 code and transpile it down to ES5 for other browsers. Let's make it really easy to write ES6 yet enqueue ES5 versions of it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.