PHP framework, routes, controllers and views
- 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
For check requirements see Check requirements
- Have two method for install
- First method is using composers
- Download Composer and install
- For create an project in Windows:
cd c:\wamp\www\ composer create-project inphinit/inphinit [project_name]
- Or (if no using Wamp/Xampp/easyphp)
cd c:\Users\[username]\Documents\ composer create-project inphinit/inphinit [project_name]
- Install in Unix-like:
cd /var/www/ php composer.phar create-project inphinit/inphinit [project_name]
- Or (if no using Apache)
cd /home/ php composer.phar create-project inphinit/inphinit [project_name]
- Alternate is download GIT repository and copy content from zip file to folder project (don't clone
master
for production use), clone last release example:git clone -b 0.5.17 --recurse-submodules https://github.com/inphinit/inphinit.git [project_name] cd [project_name]
Note: Don't use composer dev-master (eg.
create-projet inphinit/inphinit:dev-master
), to collaborate, prefer to clone with GIT, example:git clone --recurse-submodules https://github.com/inphinit/inphinit.git inphinit cd inphinit
- If using Apache (or Xampp, Wamp, Easyphp, etc) only navigate to
http://localhost/[project_name]/
- Navigate
http://localhost/[project_name]/generate-htaccess.php
for create.htaccess
- Navigate with explorer.exe to project folder
- Find and edit server.bat, change
php.exe
path andphp.ini
for your php path:set PHP_BIN="C:\php\php.exe" set PHP_INI="C:\php\php.ini" set HOST_PORT=9000
- Save the edition and run
server.bat
- Open webbrowser and navigate to
http://localhost:9000
- If using Linux or Mac navigate to project folder and run using terminal:
cd /home/[project_name]/ php -S localhost:9000 system/boot/server.php
- Open web-browser and navigate to
http://localhost:9000
- Or edit
server
#!/bin/bash PHP_BIN="/usr/bin/php" PHP_INI="/etc/php5/cli/php.ini" HOST_PORT=9000
- Save edition and run
./server
-
In folder
[project_name]/system/
findmain.php
and put something like this:Route::set('GET', '/foo', 'MyController:action');
-
In
[project_name]/system/application/Controller/
folder create an file with this nameMyController.php
(case sensitive) -
Put this content:
<?php namespace Controller; use Inphinit\Viewing\View; class MyController { public function action() { $data = array( 'foo' => 'Hello', 'Baz' => 'World!' ); View::render('myview', $data); } }
-
In
[project_name]/system/application/View/
create file with this namemyview.php
(case sensitive) and put:<p><?php echo $foo, ' ', $baz; ?></p>
-
Navigate to
http://localhost:9000/foo
orhttp://localhost/[project_name]/foo
For check requirements navigate with your web-browser to http://localhost:9000/check.php
or http://localhost/[project_name]/check.php
For setup access [project_name]/system/application/Config/config.php
with your text editor and change development
key to true
or false
:
<?php
return array(
'appdata_expires' => 86400,
'development' => true,
'maintenance' => false
);
For create nginx config run with terminal:
cd /home/[project_name]/
php generate-nginx.php
And copy content to clipboard and adjust nginx.conf
Install PHP:
- Download PHP: http://windows.php.net/download/
- Install PHP to
%SYSTEMROOT%\php
(likec:\php
,d:\php
)
Installing in IIS Express:
- Navigate to
%USERPROFILE%\Documents\IISExpress\config
- Edit
applicationHost.config
- And put in file this:
<location path="WebSite1"> <system.webServer> <handlers> <add name="PHP_via_FastCGI" path="*.php" verb="" modules="FastCgiModule" scriptProcessor="c:\PHP\php-cgi.exe" resourceType="Either" /> </handlers> </system.webServer> </location>
- Restart IIS
- Copy contents in
%USERPROFILE%\Documents\My Web Sites\WebSite1
- You can create a new website, so just change
WebSite1
to the new folder.
For more details in https://msdn.microsoft.com/en-us/library/hh994590(v=ws.11).aspx
- Navigate to
%windir%\System32\inetsrv\config\
- Edit
applicationHost.config
(requires Administrator Privileges) - And put in file this like this:
<defaultDocument enabled="true"> <files> <add value="index.php" /> <add value="Default.htm" /> <add value="Default.asp" /> <add value="index.htm" /> <add value="index.html" /> <add value="iisstart.htm" /> </files> </defaultDocument> <fastCgi> <application fullPath="C:\php\php-cgi.exe" monitorChangesTo="C:\php\php.ini" activityTimeout="300" requestTimeout="300" instanceMaxRequests="10000"> <environmentVariables> <environmentVariable name="PHPRC" value="C:\php\" /> <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" /> </environmentVariables> </application> </fastCgi>
- And after put:
<handlers accessPolicy="Read, Script"> <add name="PHP_via_FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\php\php-cgi.exe" resourceType="Either" />