![]() |
Tina4Stack
v1.0.1
The Tina4 Stack
|
Tina is the CEO of the Tina4 Corporation, as anyone knows a successful company needs a strong leader. Her skills lie in the organization of each of the girls and making sure each person collaborates properly on the task at hand. Tina is passionate about providing solutions to her customers and it is very important to her that each person is doing the job they were assigned. In a nutshell we have the following:
*
The Tina4Stack started with a need to bring some uniformity to the development I was doing in PHP and especially where I was working with other developers on the same project. I have often wondered if I should start using one of the popular frameworks out there but have decided against it for various reasons. Instead I have decided to share with you my workbench so to speak where you can also benefit from the work that has gone into this tool.
Installation is pretty straight forward. Download from the link above and unzip in your favourite place, the desktop will do fine just for a test. From there double click on the tina4.exe and you will see the following:
The Stack is built up from the following technologies which hopefully will get your development up and running in minutes. Incidentally we do not deploy any database engines for you and this should be done separately which is something we prefer.
Tina4 is a collection of tools which will help you with your PHP development. In order to make the tools easy to remember and use we have given them names so that you can identify with each of the personalities when you are working. For example Ruth is responsible for Routing, Maggy is responsible for migrations.
Now it may seem daunting to make use of tools you did not assist in building but you can use as little or as much of the tools as you want. After going over the core functionality of each of the girls in the stack I will explain the basics of how everything is supposed to work.
Ruth as we have said before is responsible for routing. Routing as you may be familiar with is the ability to handle URL requests to your website. You may be quite comfortable with writing routing tables in Apache or NGINX. If you decide to use Ruth you immediately have an application which will run on NGINX and Apache equally well. Ruth also handles security and sessions which are explained in her section.
A quick example of Ruth in action, you would get this link at http://localhost:12345/testing when developing. The output of this route would be Hello Tina4!
Wouldn't it be great if you could pass variables in your path as well, of course it would!
Cody was written to automate things that may take up a lot of repetition. At this point in time Cody helps automate Bootstrap functionaflity. Cody has a very neat Ajax handler which automatically reads form variables and passes them to the URL you specify. The Ajax handler of Cody can also handle file uploading via Ajax and when used with Ruth and Debby you have very little coding to do.
The following code will create a properly formatted Bootstrap input with all the correct classes. You can see this in action in Maggy http://localhost:12345/maggy/create
The following code will create a Javascript function called callAjax which can be used to run Ajax commands to your routing
The ajax Handler in Cody takes on the following params and should be used in Javascript on your page.
Kim likes to work with content, if you need something working quickly in HTML whilst still having access to the power of PHP then you need to see what Kim can do. In order for Kim to work correctly you need to have an assets folder under your document root. In this folder she will look for the following folders:
Here are some examples of Kim in action, hopefully from the examples you will be creating dynamic pages in a few minutes.
The {{include:snippet/[snippet_name]}} will include a section of a file into the existing file. This is much like the normal require or include of PHP except that it has the ability to render variables in {braces}. The path used is relative to the assets folder, so all your includes should be under assets.
Kim understands that it is cumbersome to reference variables in your HTML files. More so if you need to make sure their scope is correct.
The normal way
Kim's way
Kim understands that we need to access some built in functions in our HTML templates, so she made it easy.
The normal way
Kim's way
Kim is able instantiate classes as call their methods which should return either text or arrays
The normal way
Kim's way
Debby got all her experience from using Cross Database Engine for PHP which has been around for 8 years now. Debby took those features and added to the functionality. She is able to connect to the most popular database engines and because she supports ODBC the possibilities are endless. Currently the tested engines are MySQL, Firebird & SQLite3. Support is offered for Oracle, Postgres, CUBRID, MSSQL (Native) & ODBC.
All database connection files are stored under the connections folder. You can use the interface here : http://localhost:12345/debby/create to make database connections. Each database connection will be registered as an object in Ruth which will then be accessible to your code.
This connection is an SQLite3 connection
The database path is an expression consisting of the hostname and path to the database itself. This covers a multitude of different database configurations. The hostname is only compulsory if it is not localhost or your database is attached to a specific IP address or is remote from the actual server.
Debby has a few methods which communicate with the database, you should however consider using Olga or Cody's REST interface for less effort.
Debby also understands different dialects of SQL so you don't have to worry about select top or select first or limit 10. She will be able to translate those for you. She also takes care of file uploads for you.
Maggy helps you keep your database migrations current. She creates a table in your database where she tracks the changes. You can create migrations easily by going to http://localhost:12345/maggy/create.
The migrations will be stored under your migrations folder and can be edited there as well. To make the migrations work you can simply click on the browser button of Tina4 and the link to http://localhost:12345/maggy will be run.
Maggy works from the migrations folder in your document root. She looks for files with an sql extension which have been formatted as follows:
YYYYMMDDHHMMSS <Migration description>="">.sql
There are some basic rules to follow when using Maggy and these are based on database limitations with regard to transaction handling:
indexes can be created with the tables but some database engines need the transaction of the table to be committed first
Emma is used to send emails so you don't need any other libraries. She takes care of embedding rich HTML and saves sent emails to the mailspool for you so you can see what's going on.
Use the Tina4 interface to see how the email got sent.
Currently Emma uses BulkSMS to send out text messages. Let us know if you have another preference.
Tessa is used for UI testing, she has some simple commands which enable you to link up with Selenium server. By default she uses Firefox todo the testing. You will need to download the standalone Selenium server and run that before trying to run Tessa. Tessa can be run from http://localhost:12345/tessa
Have a look at the code in the test folder in runTessa.php Any functions that are found in files dropped in the test folder will be automatically injected into the runTessa class. That means you can call them from within the runTests methods by using $this->runMyTest().
Olga enables the developer to use classes as data stores for data, these objects can be mapped back to a database which Olga will use to save or restore data from If you run xcache on your system, Olga will automatically persist these objects in memory making the load on the server very light.
We could create a Pet object, all classes need to have an id for the system to reference it by from memory
We could then create a collection of pets which would use the Pet object as an array object
Olga is also quite useful for creating dynamic objects