09 14 Aug
Author: Tomas Bartkus Filed under: OxyBase     1 Comment »

First steps with OxyBase

Ok, so you have downloaded a fresh copy of OxyBase and you want to start using it? So let’s do it!

First of all, extract OxyBase-vX.X.rar to your web document root. You should have folder structure like image below shows:

OxyBase structure

This structure fulfils basic project needs. Here is the explanation what is what.

  • Application – here you will store all your application
  • Domains – all your application domains
  • Modules – all concrete domain modules
  • Documents – various documents related to concrete project
  • Html – we always have PSD file that must be converted to HTML
  • Public – this folder actually should be a document root, because it contains all public resources
  • Tools – all extra tools that you will need for project, like some php scripts to generate DB models etc.
  • UnitTests – unit tests folder, if your project is large one, you should consider using this directory

So now, when you have OxyBase in document root, got to Application/config folder and here you should find “config.recommended.xml”. Rename it to “config.xml” and open it. Find config node called “base_url” (//config/development/resources/layout/base_url) and change it to yours url. This could be something like “http://localhost/OxyBase-v0.3.1/public/” or if “public” folder is document root so “http://localhost/”. Now open your browser at this url and you should see and error that Doctrine can not connect to database, so open config.xml again and look for doctrine resource “dbparams” node and change database name, db user name, db password. Or you canis delete all <doctrine> … </doctrine> node if you do not need database connection.

That is it, you are ready to start developing. Open browser at “http://localhost/OxyBase-v0.3.1/public/” or whatever your document root is and you will see a welcome message “Frontend It is up and ready!“, add to uri “admin” (http://localhost/OxyBase-v0.3.1/public/admin) and you will get another message “Admin its up and running!“.

Setup is done now let’s star developing. I assume that you know Zend Framework and you know how to create module. If so, then all you have to know about OxyBase is only few things.
First of all, OxyBase has larger piece of grouping your code then module and it is called “domain“. So that is first thing you have to do when starting new project -  define your application domains. By default OxyBase has two domains – “Frontend” and “Admin“, but if you need another or you just don’t like the name, you can rename it or create a new folder in domains folder.
When you have your domains, you can start creating modules. OxyBase by default has one “default” module. This module can be an example for your what structure is required and how controllers, models should look like.
OxyBase module is the same as Zend Framework module, just our module components has not only module prefix, but also <domain> prefix. So our controllers are named like <domain>_<module>_<cnameController> (Frontend_Default_IndexController), models are named <domain>_<module>_Model_Standard, plugins <domain>_<module>_Plugin_Standard and so on. And everything else, that is related with coding, is the same as in Zend Framework.

Another small difference is url that points to some resource. In ZF modular structure when you want to dispatch some action you do it like “http://localhost/module/controller/action“, in OxyBase we add one more parameter in front of all, so in our environment request uri looks like:

  • “http://localhost/admin/module/controller/action”
  • “http://localhost/frontend/module/controller/action”
  • “http://localhost/frontend/module/controller/action/param/value”

And that is it, that is all you have to know about OxyBase that you could start developing. If you are good in Zend Framework then you will know what to do next, if not read my next post about how to develop modules.