Skip to main content
Go to homepage
Github

Get started

Inphinit is a minimalist framework with outstanding performance, designed to promote the use of native PHP functions rather than reinventing the wheel.

System requirements

Install using Composer

If you use composer, run the command (more details in https://getcomposer.org/doc/03-cli.md):

php composer.phar create-project inphinit/inphinit:^2.1-beta.5 my-app

If you use composer global, run the command:

composer create-project inphinit/inphinit:^2.1-beta.5 my-app

Install using Git

If you use Git, for install run this command:

git clone --recurse-submodules -b 2.1-beta.5 https://github.com/inphinit/inphinit.git my-app

Start a development server

After installation, navigate to the directory where the project was created:

cd my-app

Then run the command to start the Built-in web server:

./run serve

Then open http://localhost:5000/ in your web browser.

To customize the host and port, you can use a command like this:

./run serve --host 0.0.0.0 --port 8080

Then open http://localhost:8080/ in your web browser.

Create routes

To create a new route, edit the system/main.php file, if you want the route to only be available in development mode, then edit the system/dev.php file.

The route system supports controllers, callables and anonymous functions, examples:

<?php // anonymous functions $app->action('GET', '/closure', function () { return 'Hello "closure"!'; }); function foobar() { return 'Hello "function"!'; } // callable function $app->action('GET', '/function', 'foobar'); // callable class static method (Note: autoload will include the file) $app->action('GET', '/class-static-method', ['MyNameSpace\Foo\Bar', 'hello']); // callable class method $instance = new Sample(); $app->action('GET', '/class-method', [$instance, 'hello']);

Web Servers

Here are basic instructions to configure Inphinit on servers: