Getting Started with Tatanka

Get up and running in 5 minutes.

To start a new project with Tatanka follow these steps:

Step One - Create your application directory

Create a directory for your application.

mkdir myapplication

Step Two - Install Tatanka

Method 1, submodule install:
If you are using git version control in your project then Tatanka is designed to be installed and kept up to date as a submodule git repository.

🚧

Requirements

Method 1 requires using git v1.8+

Initialize a git repo inside your application and add the tatanka directory and contents to the root of your project as a git submodule. Tatanka is designed to be used within an existing git repository as a submodule. This makes updating Tatanka as easy as executing "git submodule update --remote".

cd myapplication/ git init git submodule add git@github.com:madchops1/tatanka.git tatanka git submodule update --remote

Method 2, stand-alone install:
If you are not using git in your project then Tatanka is designed to be installed and kept up to date as a stand-alone git repository.

Clone the Tatanka git repo into your application's root directory and name it tatanka

cd myapplication/ git clone git@github.com:madchops1/tatanka.git tatanka cd tatanka git pull origin master

Method 3, no updates, not recommended:
You can always install tatanka without git. Just download the tatanka directory, and place it in your application's root directory.

❗️

Method 3 Not Recommended

In this option you will get no updates. Updates are being made everyday. This method of installation is not recommended.

πŸ‘

Successful Install

Once you have installed Tatanka into your application's root directory, you never need to touch any file inside the tatanka directory. You should not edit the Tatanka core directory or its contents ever or you may cause update conflicts and break your app!

Step Three - Tatanka Environmental Settings

Cool now you have an application directory and tatanka inside it. Next we need to setup your application files that Tatanka needs to work right.

mkdir inc cd inc/ touch settings.ignore.php

The settings.ignore.php file contains an array of environment and database settings for your application. Below is an example of the settings configuration file. This is an advanced example with a local, remote staging, and remote production environment.

<?php /** * inc/settings.ignore.php */ if (!defined('ENVIRONMENTS')) { define('ENVIRONMENTS',serialize(array( 'production' => array( 'host' =>'www.myapplication.com', 'docroot' =>'/var/www/html/myapplication', 'dbhost' =>'myapplication.asdf.rds.amazonaws.com:3306', 'dbname' =>'db-name', 'dbuser' =>'db-user', 'dbpass' =>'db-password'), // Local Environment, e.g. MAMP 'local' => array( 'host' =>'www.localmyapplication.com', 'docroot' =>'/Users/Me/Documents/myapplication', 'dbhost' =>'myapplication.adfg.rds.amazonaws.com:3306', 'dbname' =>'db-name', 'dbuser' =>'db-user', 'dbpass' =>'db-password'), 'staging' => array( 'host' =>'dev.myapplication.com', 'docroot' =>'/var/www/html/dev.myapplication', 'dbhost' =>'myapplication.adfg.rds.amazonaws.com:3306', 'dbname' =>'db-name', 'dbuser' =>'db-user', 'dbpass' =>'db-password') ) ) ); } ?>

Step Four - Your Application's Child Class

Create your application's child class file inside the "inc" directory. You can name your class file anything.class.php

cd inc/ touch myapplication.class.php

Inside your "inc/myapplication.class.php" file you will write a class extends Tatanka's "app" class. Literally building your application on top of the built-in power of Tatanka.

<?php /** * inc/myapplication.class.php * My Application Class */ class myApplication extends app { public $debug = false; public $down = false; public $layout = 'my-application-layout'; function __construct() { parent::__construct(); $this->applicationRouter(); } function applicationRouter() { $this->getRouter(); $this->postRouter(); } // Your app's get router function getRouter() { } // Your app's post router function postRouter() { } } ?>

Step Five - Your Application's Index

Create your application's index file in the root of your application directory.

touch index.php

Here is an example index.php file.

<?php // Include the App Class include 'tatanka/app.class.php'; // Include Child App Class include 'inc/myapplication.class.php'; // Create your app instance $app = new myApplication; $app->startApp(); $app->debug(); ?>

Step Six - Your Application's .htaccess file

Create an .htaccess file in the root of your application.

AddType application/x-httpd-php .php5 <Limit GET POST> Order Allow,Deny Allow from all </Limit> # DEFAULTS AddDefaultCharset UTF-8 DefaultLanguage en-US SetEnv TZ America/Chicago # HEADER Header set Access-Control-Allow-Origin "*" # MOD REWRITE Options +FollowSymlinks RewriteEngine On # DUMMY CONNECTIONS RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC] RewriteRule .* - [F,L] # FORCE WWW RewriteCond %{HTTP_HOST} !^(www|dev)\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] # Allow any files or directories that exist to be displayed directly RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|js|css|swf|php|ico|txt|pdf|xml|ttf|eot|svg|woff|html)$ RewriteRule ^ - [L] # Rewrite the website url into the request RewriteRule ^(.*)$ index.php?request=%{THE_REQUEST} [NC,L]

That's it. Your application is set up. Next find out how to create a layout.


Did this page help you?