PHPackages                             alesanchezr/wpas-wordpress-dash - 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. alesanchezr/wpas-wordpress-dash

ActiveLibrary[Framework](/categories/framework)

alesanchezr/wpas-wordpress-dash
===============================

WordPress development on steroids

1.3.4(5y ago)175599[1 issues](https://github.com/alesanchezr/wpas-wordpress-dash/issues)MITPHPPHP &gt;=5.5.9

Since Aug 11Pushed 5y ago4 watchersCompare

[ Source](https://github.com/alesanchezr/wpas-wordpress-dash)[ Packagist](https://packagist.org/packages/alesanchezr/wpas-wordpress-dash)[ RSS](/packages/alesanchezr-wpas-wordpress-dash/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (4)Versions (19)Used By (0)

WPAS-Wordpress-Dash
===================

[](#wpas-wordpress-dash)

Are you a WordPress developer? Then you are probably struggling with the same stuff that I use too truggle every day.

1. MVC Pattern implementation (Model-View-Controller) in WordPress.
2. Create API's with WordPress very fast.

Installation
------------

[](#installation)

1. Require the library with composer (NOTE: You must be in your Wordpress directory before running this command. The installer will attempt to create your theme in ./wp-content/&lt;your\_theme\_directory\_name&gt; )

```
$ composer require alesanchezr/wpas-wordpress-dash:dev-master
```

2. Create a new theme using the installation script. Or select an already created theme (it will try to create the folder structure automatically)

```
$ php vendor/alesanchezr/wpas-wordpress-dash/run.php
```

4. Update the WPASController according to your needs in functions.php

```
use \WPAS\Controller\WPASController;
$controller = new WPASController([
        //Here you specify the path to your consollers folder
        'namespace' => 'php\\Controllers\\'
    ]);
```

**Note:** This library expects your theme to load the *vendor/autoload.php* file in your *functions.php*. A good way of doing that is:

```
/**
* Autoload for PHP Composer and definition of the ABSPATH
*/

//defining the absolute path for the wordpress instalation.
if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/');

//including composer autoload
require ABSPATH."vendor/autoload.php";
```

If you are working with Flywheel hosting (and/or Flywheel Local), you will need to require the path in the following way:

```
if(!strpos($_SERVER['SERVER_NAME'], '.local')){
  require 'vendor/autoload.php';
}else{
  require ABSPATH . 'vendor/autoload.php';
}
```

This is due to the fact that their folder structure separates your content and plugins from the root Wordpress install after you push your site live.

Working with the MVC Pattern
----------------------------

[](#working-with-the-mvc-pattern)

### The Models (Custom Types)

[](#the-models-custom-types)

Instanciate the PostTypeManager:

```
    $typeManager = new \WPAS\Types\PostTypesManager([
        'namespace' => '\php\Types\\' \\this will be the path to your models folder
    ]);
```

Define your type in functions.php

```
    //You can react a new custom post type and specify his class
    $typeManager->newType(['type' => 'your_type_slug', 'class' => 'AnyPostTypeModelClass'])->register();
```

Define your type class in the types folder:

```
    namespace php\Types;

    class AnyPostTypeModelClass extends \WPAS\Types\BasePostType{

        //any method here
    }
```

Note: you HAVE to extend from the BasePostType class, that is not optional.

[Continue reading about the models](https://github.com/alesanchezr/wpas-wordpress-dash/tree/master/src/WPAS/Types)

### The Controllers

[](#the-controllers)

Create your ***Controller*** classes and bind them to your views, pages, categories, posts, etc.

```
//Here we are saying that we have a class Course.php with a function getCourseInfo that fetches the data needed to render any custom post tipe course
$controller->route([ 'slug' => 'Single:course', 'controller' => 'Course' ]);
```

Our Course.php controller class will look like this:

```
namespace php\Controllers;

class Course{

    public function renderCourse(){

        $args = [];
        $args['course'] = WP_Query(['post_type' => 'course', 'param2' => 'value2', ...);
        return $args; //Always return an Array type
    }

}
```

[Continue reading about implementing MVC on your wordpress](https://github.com/alesanchezr/wpas-wordpress-dash/tree/master/src/WPAS/Controller)

Debugging
---------

[](#debugging)

On you wo-config.php file add the following constant:

```
define('WP_DEBUG_CONTEXT', true);
```

It will add a top bar with the current template being used.

Upcomming Experimental Features (Not Stable)
--------------------------------------------

[](#upcomming-experimental-features-not-stable)

1. Add WordPress roles programatically.
2. Restrict Role Access to particular pages, posts, categories, etc.
3. Create and manage all your custom post types in just a few lines of code.
4. Hit 100% on the [Google Page Speed test](https://developers.google.com/speed/pagespeed/insights/).
5. Messaging notification system for the WordPress admin user, using the WordPress standards.
6. Create new [Visual Composer](https://vc.wpbakery.com/) components for your theme in just 5 lines fo code.
7. Extend [Gravity Forms](http://www.gravityforms.com/) functionality.

### Author

[](#author)

**Alejandro Sanchez**

*Repository website:*

*About me:* [alesanchezr.com](http://alesanchezr.com)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 97.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~69 days

Recently: every ~265 days

Total

18

Last Release

2066d ago

Major Versions

0.1.11 → 1.1.122017-08-12

PHP version history (3 changes)0.1PHP &gt;=5.3.0

1.1.19PHP &gt;=7.0.0

1.3.1PHP &gt;=5.5.9

### Community

Maintainers

![](https://www.gravatar.com/avatar/61d94492a6ba90c559ef0043808e9a874a2f17d92b11d50337e8fdbba9065d52?d=identicon)[alesanchezr](/maintainers/alesanchezr)

---

Top Contributors

[![alesanchezr](https://avatars.githubusercontent.com/u/426452?v=4)](https://github.com/alesanchezr "alesanchezr (191 commits)")[![jferragut](https://avatars.githubusercontent.com/u/31458614?v=4)](https://github.com/jferragut "jferragut (3 commits)")[![caenavgu](https://avatars.githubusercontent.com/u/21110050?v=4)](https://github.com/caenavgu "caenavgu (1 commits)")

---

Tags

wordpress-php-librarywordpress-pluginwordpressrolesajaxcontrollercapabilitieswordpress-librarywordpress-mvc

### Embed Badge

![Health badge](/badges/alesanchezr-wpas-wordpress-dash/health.svg)

```
[![Health](https://phpackages.com/badges/alesanchezr-wpas-wordpress-dash/health.svg)](https://phpackages.com/packages/alesanchezr-wpas-wordpress-dash)
```

###  Alternatives

[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M465](/packages/pimcore-pimcore)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k16.2k54](/packages/elgg-elgg)[contao/core-bundle

Contao Open Source CMS

1231.6M2.7k](/packages/contao-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
