Getting started with Grand Central

Start a new project from scratch

Introduction

Installing Grand Central
We've build an install app so you don't have to go through the hassle of configuring the files. Download Grand Central From GitHub and hit the root in your browser. The Install App will take care of creating databases, config files and folders for you. You're good to go.

Why Grand Central
Grand Central has been around since 2004, as a licensed BtoB software. The last licensed-distributed release was the 3.20. In the hundreds of solutions out there, we simply couldn't find the right balance between scalability, robustness and sexiness. We rebuilt 4.0.0 from scratch, with a couple of things in mind:

  • API-oriented, so we don't presume of how your data will be used or displayed.
  • object-oriented, so the maintenance of your code would be easy, and long-lasting.
  • composed of apps, so reusability of what you've built is easier than ever.
  • sexy as hell, so people actually want to use it.

Learning the lingo
Like all systems made to be used everyday, Grand Central evolved a lingo of its own. These few words can help you making your way through virtually all major needs.

  • items (abbreviated i): items are the base of all your date. One item is an object you manipulate in real-life, a line in your database and an object in the code.
    In real-life context, one item refers to a object you manipulated. If you are selling socks, one item is going to be one sock. One item can be one page, one ticket, one blog post, &c.
    In database context, one item refers to one line of a table of your database, and its relations.
    In development context, one item is an object with a set of methods. You can save items $item->save(), delete them $item->delete(), &c. You can extend the abstract _items class and add you own methods, so you can sell items $item->sell().
// This is how you get the 'sock' with id 123
$sock = i('sock', 123);
  • attributes (abbreviated attr): attributes are containers of value defined for each items. For instance, the item sock has an attribute color, which can be set to the values red or blue (these are strings). Attributes have a type: strings, bools, arrays...
// This is how you get the value of an attribute
$color = $sock['color']->get();
// This is how you print the value of an attribute
echo $sock['color']->get();
echo $sock['color']; /* shortcut arrayAccess */ 
// This is how you set the value of an attribute
$sock->set('color', 'red');
$sock['color'] = 'red';  /* shortcut arrayAccess */ 
  • relations (abbreviated rel): relations are directional connexions between an item and another item. You can connect your 'socks' to a 'collection' for instance, to mean that 'the item has a collection'. $sock['collection'] would then contain an array of nicknames connecting this 'sock' to one or many 'collections'. By unfolding the relation $sock['collection']->unfold() you can fetch the bunch of 'collections' and manipulate them easily.
// This is how you change a relation of an item
$sock['collection'] = 'collection_123';
$sock['collection'] = array('collection_123', 'collection_456');
// This is how you fetch a bunch of relations
$socksCollections = $sock['collection']->unfold();
  • bunch: a bunch is a collection of items. It's the easiest way to handle many socks, or many pages at the same time.
// This is how you get a bunch of all your 'socks'
$socks = i('sock', all);
  • parameters (abbreviated param): parameters are associative arrays of keys and values used to refine bunches. Keys stand for attributes or relations, and values filter the bunch.
// This is how you get a bunch of socks with the attr 'color' set to 'blue'
$socks = i('sock', array(
    'color' => 'blue'
));
  • apps: apps are bundled folders and files designed to do one thing, and to do it right. Except the boot file and the config file, everything in Grand Central is an app. The Core of Grand Central is an app itself. The default install of Grand Central contains the Core app and some apps required by the system to run. But you will be packaging apps as you go, reuse them and distribute them, making development blazing fast.
    An app can be php only, like the phpMailer app, and offer resources under the shape of php classes and php functions. An app can be js only, like the jQuery pace app, and offer resources under the shape of jQuery plugins or javascript functions. An app can be a mix of everything and combine php, javascript and templates.
// This is how you load an app
load('jqueryPace');
// This is how you load many apps
load('jqueryPace', 'phpmailer');

Classes

  • gcInstall

    Installation class Create dir, fill database and create inc.config.php

about

URL
Version
  • 1.0.0

License
Author
  • SF

requirements

PHP
  • 5.4.x

MySQL
  • 5.3.x

system

Class