• Stars
    star
    624
  • Rank 71,995 (Top 2 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 13 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An MVC framework for WordPress

WP MVC

An MVC framework for WordPress

Description

WP MVC is a WordPress plugin that allows developers to use a MVC framework to create plugins. It is a full-fledged framework with architecture that's similar to that of CakePHP or Ruby on Rails. Developers can consequently use it to rapidly build sites that take advantage of both WordPress's native functionality and all of the many advantages of an MVC framework.

WordPress supports a number of specific content types natively, but setting up custom post types and all of the necessary related functionality (public views, administrative management, associations, etc) is typically more time-consuming than doing the equivalent work in an MVC framework. The resulting code and database structure is significantly less graceful than the MVC equivalent, too.

WP MVC fills this gap. The basic idea is that you create an app/ directory that contains a file structure similar to other MVC frameworks (controllers/, helpers/, models/, views/, etc) and set up models, views, and controllers just as you would in other frameworks. WP MVC runs this code in the context of WordPress (i.e. you can still use all of WordPress's functionality inside of app/). Since WordPress already provides an administrative system, admin actions and views in app/ are run in that context, with WP MVC adding all of the necessary WordPress actions and filters to make this possible without the developer needing to lift a finger. An Administration Menu is automatically created for each model, but it can be customized or omitted.

For more extensive documentation, and to see what WP MVC is capable of, please visit wpmvc.org. Check out the tutorial to see how quickly you can get an app up and running.

If you'd like to grab development releases, see what new features are being added, or browse the source code please visit the GitHub repo.

Installation

  1. Put wp-mvc into the wp-content/plugins directory
  2. Activate the plugin in the "Plugins" menu in WordPress
  3. Make sure that Pretty Permalinks are enabled and working
  4. Either set up one of the example plugins to see how WP MVC works or start creating a plugin using the code generation utility wpmvc:

Setting up one of the example WP MVC-based plugins:

  1. Copy its directory (e.g. wp-content/plugins/wp-mvc/examples/events-calendar-example) into the wp-content/plugins directory (e.g. wp-content/plugins/events-calendar-example)
  2. Activate the plugin in the "Plugins" menu in WordPress

After doing so, you should see administrative menus for each model in WordPress, and you'll be able to browse to URLs like /events/, /events/1/, /venues/, etc to see the public-facing views.

Creating a WP MVC-based plugin

It only takes four simple steps to create a basic WP MVC-based plugin:

  1. Create the initial plugin code using a single command (WP MVC provides a code generation utility)
  2. Write the SQL to create any tables that the plugin uses
  3. Create the initial code for the models, views, and controllers using a single command for each resource
  4. Modify the generated models, views, and controllers to customize the app

For a simple example tutorial on this, please see the tutorial on wpmvc.org.

Frequently Asked Questions

What relation does this have to other MVC frameworks?

WP MVC is a full-fledged MVC framework, but behind the scenes it uses existing WordPress functionality to lessen its footprint and better interface with the parent WordPress application. The developer will not need to know about much of this, though, and may merely treat it as another MVC framework. It draws on concepts and workflows from other MVC frameworks; Rails and CakePHP are the biggest influences, and you may see some of their naming conventions being used.

Is feature X available?

If there's functionality that you'd like to use that isn't implemented in the example plugins or mentioned on wpmvc.org, it may not exist yet. However, if it's something that is widely useful, I'd certainly be willing to implement it myself or to accept any well-written code that implements it. Please feel free to either add a topic in the WordPress forum or contact me through GitHub for any such requests:

More Repositories

1

nui

Style iOS apps with a stylesheet, similar to CSS
Objective-C
3,763
star
2

ru

Ruby in your shell!
Ruby
403
star
3

reports_kit

Beautiful, interactive charts and tables for Ruby on Rails
Ruby
362
star
4

nested-hstore

Store nested hashes in hstores in ActiveRecord
Ruby
87
star
5

nikkou

Extract useful data from HTML and XML with ease!
Ruby
57
star
6

toro

Multithreaded message processing on Postgres
Ruby
38
star
7

paws

Keyboard shortcuts for the AWS Console
JavaScript
36
star
8

NUIParse

A fork of CoreParse, a parsing library for Mac OS X and iOS
Objective-C
22
star
9

omnom

An everythingreader for programmers
Ruby
19
star
10

freeb

Store the world's knowledge in ActiveRecord
Ruby
18
star
11

jdoc

Documentation markup for large projects
Ruby
18
star
12

heroku-schemas

Run many apps on a single database
Ruby
14
star
13

prelude

Boilerplate Rails app for rapid prototyping; Bootstrap, Backbone.js, Devise, S3, and more
Ruby
14
star
14

mysql-profiler

A SQL profiler for WordPress
PHP
12
star
15

has_response

Extremely simple, flexible API support for Rails
Ruby
9
star
16

noder

Node.js for Ruby
Ruby
8
star
17

hierarchical-documentation

Lets WordPress admins create searchable, hierarchically-organized documentation. Supports Markdown and syntax highlighting for code. Requires WP MVC.
PHP
7
star
18

expressr

Express.js for Ruby
Ruby
7
star
19

wp-coffeescript

Use CoffeeScript in WordPress
PHP
6
star
20

coach

A highly tunable classifier (Bayes classification & explicit rules)
Ruby
6
star
21

concurrently

Simple, easy concurrent processing in Go
Go
6
star
22

djangotorails

Automate the process of porting a Django app to Rails
Ruby
5
star
23

has-many-autocomplete

Autocomplete and sortable list for has_many associations in Rails
Ruby
4
star
24

multicron

MultiCron - A better way to manage cron jobs for applications
Shell
4
star
25

crystallize

Generate gems!
Ruby
3
star
26

minijs

A JavaScript and CoffeeScript minifier for Django
Python
3
star
27

profiler

Easy, targeted Ruby profiling
Ruby
3
star
28

wp-mvc-doc

Documentation for WP MVC
CSS
2
star
29

simple_acl

Simple ACL - Extremely simple ACL functionality for CakePHP
PHP
2
star
30

reports_kit_docs

The documentation for ReportsKit
Ruby
2
star
31

omnom-app

Example app for Omnom
Ruby
1
star
32

jdoc-example

An example of a JDoc site
JavaScript
1
star
33

rh

Fast Ruby documentation lookup
Ruby
1
star
34

browse

Open Mechanize pages in a (human-readable) browser
Ruby
1
star