About Simplx Mirage

Simplx Mirage

Simplx Mirage is an alternative programming interface for MODX Resources. It uses the MODX API under the hood, but simplifies a lot of things for you.

With Simplx Mirage you can create, query and update Resources, including their Template Variable values, just as if they were normal PHP objects.

Mirage sees Templates as Classes and Resources as Objects. 

A Template called "Product" has a bunch of Template Variables such as 

  • price
  • stock
When a Resource uses this Template, Mirage will consider that Resource an object instance of the class Product. The following code will get Products which cost less or eq to 10 and have a stock of more than 0:

$productClass = new Simplx_Mirage_Class('Product');

$productList = $productClass->getObjects(array('price:>=' =>10, 'stock:>' => 0));

Go to https://www.youtube.com/watch?v=KSwawpi5-qc for a quick intro.

Read the docs on https://github.com/larscwallin/simplx_mirage/blob/master/README.md

Information

Released
November 6, 2014

Supported Database
MySQL

License
GPLv2

Supported Versions
2.2 - <2.3

Downloads
1,193

Instructions

Simplx Mirage is simple to install.

  • Install using Package Management
  • Execute the simplx.mirage.setup Snippet (very important) by adding it to a page and visiting the page using your browser (to much information? ;)
  • Go into System Settings and search for mirage. You will find two Setting items

    • simplx.mirage.object.viewname - The name of the Mysql view which is used by Mirage
    • simplx.mirage.setup.hasrun - A boolean flag indicating if setup was run successfully
  • To use, Include require_once($modx->getOption('core_path').'/components/simplx/mirage/simplx_mirage.php'); in any Snippet, Plugin or php file.

  • Optionally turn on debugging output for each of the Mirage components while developing by adding the following code to your Snippet, Plugin or file.

Simplx_Mirage::$_debugmode = true; 

Simplx_Mirage_Class::$_debugmode = true; 

Simplx_Mirage_Object::$_debugmode = true;

  • All things should be good to go!

New in 1.0.0-beta2

BETA 2

Fixed query cache bug.

Current releases

1.0.0-beta2
View | Download
November 6, 2014
2.2 - <2.3