-
Notifications
You must be signed in to change notification settings - Fork 8
Getting Started
- PHP 5.3.0+
- Multibyte String (GD also) (optional, only used in
Inphinit\Helper::toAscii) - libiconv (optional, only used in
Inphinit\Helper::toAscii) - fileinfo (optional, only used in
Inphinit\File::mime) - Apache or Nginx or IIS for production
You can use composer, after composer installed navigate to server folder (if using Apache, Nginx or IIS):
- If using server in Unix-like eg.
cd /var/www - Xampp eg.
cd c:/xampp/htdocs - Wamp eg.
cd c:/wamp/www
Perform composer for create a new project (replace [project_name] by folder name, like blog):
composer create-project inphinit/inphinit [project_name]
If is not global you can use:
php composer.phar create-project inphinit/inphinit [project_name]
Navigate to [project_name] using explorer, finder or terminal, like this:
cd [project_name]
Note: for install using GIT or for contributors: Install using GIT
If is not using Apache, Nginx or IIS your can try server built-in using server.bat or server.sh. If you use Windows edit the server.bat and change PHP_BIN and PHP_INI variables:
set PHP_BIN="C:\php\php.exe"
set PHP_INI="C:\php\php.ini"
set HOST_PORT=9000
To start use double click in server.bat or type in cmd/PowerShell like this and press Enter:
C:\Users\User> server.bat
If using Unix-like edit PHP_BIN and PHP_INI (you may need to replace bash path #!/bin/bash):
#!/bin/bash
PHP_BIN="/usr/bin/php"
PHP_INI="/etc/php5/cli/php.ini"
HOST_PORT=9000
In terminal type this:
$ ./server.sh
In index.php has 3 constants:
define('INPHINIT_START', microtime(true));
define('INPHINIT_ROOT', rtrim(strtr(dirname(__FILE__), '\\', '/'), '/') . '/');
define('INPHINIT_PATH', INPHINIT_ROOT . 'system/');
define('INPHINIT_COMPOSER', false);The only thing you need is INPHINIT_COMPOSER, if true you are using composer, if false you are using inphinit-autoload (this is recommended for being faster and more efficient)
In ./system/application/Config/config.php you have 3 main variables:
'appdata_expires' => 86400, //Used to temporary files in ./system/storage/temp folder
'development' => true, //Define if project is configured to development or production server
'maintenance' => false //Disabled Routes and 'ready' event if `true`In ./system/dev.php you can perform events, functions and create routes available only for development server, for example show error in a View:
<?php
use Inphinit\Experimental\Debug;
Debug::view('error', 'debug.error');It is not necessary to adjust the
error_reportingordisplay_errors, the framework already configures it according to the type of environment.
After create your project in Apache folder (eg. /var/www, c:/wamp/www, c:/xampp/htdcos, etc) access in your browser this address http://localhost/[project_name]/generate-htaccess.php (replace [project_name] by folder project name), if using production navigate to http://example/generate-htaccess.php or other machine in your network navigate to IP server, example http://10.0.0.20/generate-htaccess.php. No needs copy output from web-browser .htaccess has already been generated.
You can navigate to http://localhost/[project_name]/generate-ngix.php or use cmd or PowerShell (CLI), in project folder perform this command:
php generate-nginx.php
After copy the output contents and edit nginx.conf in Nginx folder, for more details see https://www.nginx.com/resources/wiki/start/topics/examples/full/
To simplify checking the server requirements cited in Server requirements, you can navigate to http://localhost/[project_name]/check.php
Inphinit the PHP Framework is writed using PSR-1, PSR-2 and PSR-4, you can use Controllers, Views, Routes
- Getting Started
- About
- Performance
- Directory Structure
- Constants
- Routing
- Controllers
- Views
- Events
- HTTP Response
- HTTP Request
- HTTP Redirect
- HTTP Content Negotiation
- Storage and Files
- Rest
- Maintenance
- Regular Expression
- Response Cache
- DOM, XML, HTML, JSON and Arrays
- QuerySelector (CSS-selectors) with PHP
- Configuration
- Instalação
- Sobre
- Desempenho
- Estrutura das pastas
- Constantes
- Rotas
- Usando Controllers
- Usando Views
- Eventos
- Resposta HTTP
- Requisição HTTP
- Redirecionamento HTTP
- Negociação de Conteúdo HTTP
- Armazenamento e Arquivos
- Usando Rest
- Manutenção
- Expressão Regular
- Cache Resposta
- DOM, XML, HTML, JSON e Arrays
- QuerySelector (seletores-CSS) com PHP
- Configuração