The framework is mine and really has reason for everything in how it was done, unfortunately I have not had time to document it in a way that can make it useful, I will try not to delay in the explanation and as time will edit to add details.
How other frameworks work
To explain why the structure is this:
./public_html
├───index.php
└───system
├───application
├───vendor
└───boot
You need to understand how other frameworks work, most of them use a directory within the project folder called ./public
(Laravel) or ./webroot
(cakephp), etc. This requires that at the time of publishing an online project the developer/administrator points to folder these folders as being the root
site, this is sometimes laborious and sometimes on more limited servers like Shared servers it is necessary to move content to public_html
and take the rest of the content and put it away, which can eventually confuse a little for those who have no experience.
Of course, just follow the guidance on the sites that have the documentation, but I still notice many people with difficulty in this.
How the structure works
My idea in the framework was that you could easily move the content from one place to another without having to adjust anything, so the structure was like this:
./home/user/public_html
├───index.php # Arquivo principal que inicia tudo
└───system # Pasta aonde ficarão os dados e funcionalidades
├───application # Pasta dos Controllers, Models e Views
├───vendor # Pasta aonde fica o nucleo do framework e frameworks de terceiros instalados via composer
└───boot # arquivos de inicialização da aplicação, "cache" dos namespaces
Some may ask that when leaving the folder system
inside public_html
and www
can be unsafe, in many cases this would be really correct, but the system uses routes and ignores the folder access ./system
, i asked a lot of questions about security, locks and/or attempts to cause some fault, basically . htaccess this way:
RewriteRule "^system/" "index.php" [L]
And if mod_rewrite is disabled apache will issue the error 500 Internal Error Server
.
The folder still exists system/storage
that contains any type of data used in the application, in environments like-Unix he still force use 0600
as permission:
$r = is_dir($fullName) ? true : mkdir($fullName, 0600, true);
The whole idea is to simplify the understanding to the maximum of who is starting, for example, instead of adding the route settings in a file in a subfolder I tried to leave free to develop as you want inside two files the system/main.php
and the system/dev.php
, main.php is the main file of every project together with controllers and views, dev.php is only used if it is in development mode.
At first I thought I’d do something like:
./home/user/public_html
├───index.php
├───application
├───vendor
└───boot
Which would simplify, but I’d have to do this on no . htaccess:
RewriteRule "^(application|vendor|boot)/" "index.php" [L]
And I also thought that maybe the developer could make some confusion between main.php and index.php, aside from the possibility that the developer believes that the folders are insecure and so move more easily every application without having to move a folder by one, doing something like that:
./home/user
├───system
│ ├───main.php
│ ├───vendor
│ └───boot
└───public_html
└───index.php
And changing in the index php. the value of INPHINIT_PATH
of:
define('INPHINIT_PATH', INPHINIT_ROOT . 'system/');
To:
define('INPHINIT_PATH', INPHINIT_ROOT . '../system/');
In short
The briefcase ./system
is the project of truth and what is outside of it is just what initiates it, being able to be the index.php
or server built-in server with server.bat
or server.sh
.
+1 ... mass ... a question still does not have a
ORM
inlaid?– novic
@Virgilionovic doesn’t have it yet, because ORM is something very complex to have time, but it is possible to use any ORM framework together with this, through Composer, an example is http://propelorm.org or Doctrine. The idea of the framework is to be able to use with anything, but I intend to create a ORM in the future :)
– Guilherme Nascimento