Basic Concept

Folder Structure

- Application
- Controllers
- Logs
- Models
- Views
- Middlewares
- Services
- Database
- Migrations
- Seeds
- Utilities
- Helper
- Lang
- Public
- Routes

Most of the application will live inside the Application folder, which consists of all self-explanatory components via its folder names. Firstly, we will focus on the few that is needed for a quick head start.

Components

There are 3 main components to get started quickly:

Routes

Routes/web.php
<?php
use MightyCore\Routing\Router;
$route = new Router();
$route->get('/', '[email protected]')->name('home');

Before you can start kicking with your application, you need to set up a route first. Simply put, the above route will redirect your web's root URL to HelloController and its method, view().

Controller

You would then want to set up a controller as such which will complement our route:

Application/Controllers/HelloController.php
<?php
namespace Application\Controllers;
use Application\Controllers\Controller;
class HelloController extends Controller {
public function view(){
return view("hello_world")
}
}

The controller with the view() method on top, returns a view that points to the hello_world file. This file will be located in Application/Views/hello_world.html.

View

Application/Views/hello_world.html
<html>
<body>
<h1>Hello World</h1>
</body>
</html>

Running the Application

Now that you have the basic set up ready, go on and open your terminal at the root level of the project directory and run the following command:

php mighty start

You can now open up your browser and navigate to localhost:8000, and you will be able to see your Hello World application up and running.