The Data Object

The $data object is a collection of information about your site that can be accessed in your front-end. There are three levels that the data falls into.

Level 1


Level 2


Level 3



The 'site' key contains information about the site as a whole, including the site name, description, meta data, URL, API keys, and anything that needs to be accessible on all pages.

A few examples of what's contained

  • $data['site']['title']: The Site Title. Typically used in the <title> tag and in emails.
  • $data['site']['description']: The Site Description. Typically used in meta description tags, OpenGraph, and other SEO related tags.
  • $data['site']['baseURL']: The URL of your website. This is used for generating absolute links in your site and in emails.

You can add as many of these site values as you want! Navigate to project-files/framework-setup.php and add your values under the "Custom integrations and global variables" section at the bottom.

Here is a list of the total values. Overwriting these may cause unintended effects so try to make unique ones if possible.



The 'page' key contains information about the specific page that the user is on. This key comes with... nothing! This is what you set in your project-files/site-routes.php file.

You can make as many custom values here to fit your page needs: SQL query data; PHP arrays; text; the time; date; whatever you can think of! The name of the key is how you reference in Twig.

// My cool new page
// project-files/site-routes.php
$Router->get('/my-custom-page/', function () {
    global $data;

    $data['page']['title'] = 'My Awesome New Page';
    $data['page']['template'] = 'my-custom-page';
    $data['page']['myCustomName'] = 'Yuri Catsuki';
    $data['page']['todaysDate'] = date("M d, Y");

	<h1>Welcome, {{ page.myCustomName }}</h1>
	<p>It is currently {{ page.todaysDate }}</p>

Turns into:

	<h1>Welcome, </h1>
	<p>It is currently </p>


The 'user' key contains information about the specific user that is visiting your site. At a minimum, this key contains two values:

  • $data['user']['authenticated']: By default this is set to false. If you expand your site to include authentication, this value will automatically change when the user is logged in.
  • $data['user']['ip']: This is set to the user's IP address. Not 100% perfect but you can use it to show specific content based on general location or restricting content to a specific IP range.

This 'user' key will get it's most use out of the authentication package that you can install with Celestial. It will store everything from your SQL tables about the user (i.e. name, address, phone number, preferences).