Openovate | Open Source Innovations

Getting Started



THE FRAMEWORK


Eve framework just like any framework is a set of available classes you can optionally use to develop any type of application that is capable to do in PHP. Although PHP is intended to be used to build web applications, we cannot assume that every project using Eve is a website and we intend not to limit Eve to just that. From a very low level, Eve makes an attempt to solve for the given problems specifically for developers.



THE EVE FUNCTION


The Eve function is simply a driver for a root class which performs two tasks. The first task is to run a default bootstrap and the second one is a class router which is by definition is a factory pattern, given a name, loads the actual intended class or calls the actual intended method. This global class can be thought of as the single point of entry for all methods. In Eve, classes of availability (classes that do not require parameters in the construct) are virtually inherited by the global class. The flow chart below explains how this type of multiple inheritances is done which only applies to the global class itself.


Example 1


The example below is a sample of how a developer would use this.


Example 2



Currently Eve inherits methods from the following classes of availability.


Class_Event Event listening and trigger functionality for PHP which was just usually available in JavaScript
Class_Router Ability to route and call methods using a factory pattern
Datetime_Date General date methods
Datetime_Time General time methods
Datetime_Zone General time zone methods
Location_Country General country methods
Location_State General state methods
Session_Client General methods dealing with cookies
Session_Server General server session methods
System_Cache General cache methods
System_File General file methods
System_Folder General folder methods
System_Image General image methods
System_Path General path methods
Utility_Registry Global registry methods
Utility_Report Trace, logs and benchmark tools
Utility_Template Simplified templating methods
Utility_Tools Miscellaneous methods

For classes that are not classes of availability you can use the Eve function to call those methods directly by using one of the examples below.


Example 3


When classes are called like this you may also define shortcut names when used will be routed to the correct class. The example below describes how this is done.


Example 4



Also when methods are called like Example 3 you may also define shortcut names when used will be routed to the correct method. The positive side effect of this allows you to add methods to a class which were not originally defined. The example below describes how this is done.


Example 5


Although the use cases are endless, we make this available for only one reason. That is so that classes defined by a developer do not necessarily need to be modified by another in the cases that class lacks the specific functionality needed. The flow chart below describes how Example 3-5 was accomplished.


Example 6



CLASS REQUIREMENTS AND COMMONALITY


A class can always take advantage of Eve’s core functionality by simply extending it with either an Eve class or Base_Class. To make Eve work with a class you simply need to define a get method. This method is used by Eve to determine how it should load a class. Two core examples are load as a singleton (one instance every time) or as a multiple (make a new instance every time). The following example shows the use of Base_Class and the get method.


Example 7



This is example shows everything we need to call it from Eve. It should be noted that although you should properly java doc, It’s Eve standard practice to sectionalize class parts. The example below shows how we could use this class.


Example 8



GLOBAL REGISTRY


A global registry is a free-for-all list of variables that is accessible and available to change in any scope of code. Eve’s registry is more like a matrix of variables than a list of. There are two parts required to enter a registry, which is a path and a value. A path is a set of keys when referenced will point to a value. When retrieving data, incomplete paths will return a key-value list instead. The following example explains how to set, get and remove values in the registry.


Example 9

Contact Us | openovate.com. All rights reserved.