Structure

The default structure of the Inphinit app provides a simple-to-understand structure for organizing your projects, regardless of size. However, you can modify most of the structure by adjusting the constants.

Folder structure

.htaccess file

.htaccess is used by Apache web servers to configure routes and the main error codes that can be issued by the server, allowing to customize pages or generic error responses.

index.php file

index.php is the script that starts the application. It allows you to configure the autoload system and even change the folder structure, if necessary. Note that changing the folder structure is not recommended. If you want to add other PHP projects, such as a blog or similar, you can place them in the public folder or add a DocumentRoot for each project.

server file

server is a shortcut for Unix-like servers, such as macOS and Linux, to start the application on a PHP built-in web server. Before using you must edit the shortcut and adjust the variable values:

# Setup PHP and PORT PHP_BIN=/usr/bin/php PHP_INI=/etc/php.ini HOST_ADDR=localhost HOST_PORT=5000

{placeholder}

./server PHP Development Server (http://localhost:5000) started

server.bat file

server.bat is a shortcut for Windows, to start the application on a PHP built-in web server. Before using you must edit the shortcut and adjust the variable values:

rem Setup PHP and PORT set PHP_BIN=C:\php\php.exe set PHP_INI=C:\php\php.ini set HOST_ADDR=localhost set HOST_PORT=5000

{placeholder}

server PHP Development Server (http://localhost:5000) started

web.config file

web.config is used by IIS web servers to configure routes and the main error codes that can be issued by the server, allowing to customize pages or generic error responses.

public folder

public/ is the folder where other scripts, PHP applications and static files should be stored to be served without the need for the routing system.

checkup.php file

public/checkup.php is a script used to check the conditions generally required to run your application. See more details in Checkup.

system folder

system/ is folder containing your application.

dev.php file

system/dev.php serves the same purpose as system/main.php, however it only runs in development mode and should not be used for production. You can define routes and other instructions as required for the environment type. See more details in Debugging.

errors.php file

system/errors.php should contain error page settings, such as when a 404 or 405 error occurs, you can call static files or use views. See more details in Error pages.

main.php file

system/main.php is a script used to define routes, route scopes, implicit controllers and other instructions.

boot folder

system/boot/ is contain settings for inphinit_autoload, similar to composer_autoload.

importpackages.php file

system/boot/importpackages.php is a script used to import packages installed via composer into inphinit_autoload. This script is automatically executed by composer.json on every update, such as when installing or removing packages.

namespaces.php file

system/boot/namespaces.php indexes all packages installed via composer and should not be changed manually, the data in this file is generated by importpackages.php.

configs folder

system/configs/ is contain varied configuration files, it is recommended that you do not version this folder. See more details in Configurations.

debug.php file

system/configs/debug.php contains settings for the debugging system used by development mode, these settings allow you to configure an editor to open files that cause errors or integrate possible error messages with search engines from other sites. See more details in Debugging.

app.php file

system/configs/app.php contains settings for the application is operation, such as enabling or disabling development mode and configuring X-Forwarded-Proto (XFP) and X-Forwarded-Host (XFH). See more details in:

controllers folder

system/controllers/ is must contain the classes that will be controllers used in the routes. See more details in Controllers.

storage folder

system/storage/ is {placeholder}

vendor folder

system/vendor/ is contain third-party packages and the framework

views folder

system/views/ is should contain your views

Go to homepage
Star us on Github