PHP Web Framework Aura PHP

Aura PHP MVC Tutorial
Aura PHP MVC Tutorial

Live stream set for 2025-08-25 at 14:00:00 Eastern

Ask questions in the live chat about any programming or lifestyle topic.

This livestream will be on YouTube or you can watch below.

Getting Started with Aura PHP: MVC Example with MariaDB

Are you looking for a lightweight, flexible PHP framework to kick off your next project? Aura PHP is an excellent choice for beginners and experienced developers alike. It’s built around modular, decoupled components and fully supports the MVC (Model-View-Controller) pattern, making it easy to build structured applications.

In this beginner-friendly post, we’ll walk through:

  • Installing Aura PHP using Composer
  • Setting up a simple MVC application
  • Connecting to an existing MariaDB database table
  • Outputting all results as HTML

We’ll also provide a screencast and screenshots below so you can follow along visually. Let’s dive in!

What is Aura PHP?

Aura PHP is a collection of independent, decoupled libraries for PHP. The Aura framework uses a clean, no-magic approach that emphasizes explicit dependency injection, testability, and simplicity.

Installation Using Composer

Make sure you have Composer installed. Then create a new project directory:

mkdir aura-app
cd aura-app
composer require aura/sql aura/router nyholm/psr7 http-interop/http-factory-guzzle

This sets up an MVC structure using Aura libraries.

Update composer.json to autoload your classes:

"autoload": {
  "psr-4": {
    "App\\": "app/"
  }
}

Then run:

composer dump-autoload

Connect to a MariaDB Database

Suppose you already have a MariaDB table named users with the following structure:

CREATE TABLE users (
  id INT PRIMARY KEY AUTO_INCREMENT,
  name VARCHAR(255),
  email VARCHAR(255)
);

File Structure Overview

Your folder structure might look like:

aura-app/
  |-- app/
  |    |-- Controller/
  |    |-- Model/
  |    |-- View/
  |-- public/
  |    |-- index.php
  |-- vendor/
  |-- composer.json

MVC Example: Fetch Users

Model/UserModel.php

namespace App\Model;

use Aura\Sql\ExtendedPdo;

class UserModel {
    protected $db;

    public function __construct(ExtendedPdo $db) {
        $this->db = $db;
    }

    public function getAllUsers() {
        return $this->db->fetchAll('SELECT * FROM users');
    }
}

Controller/UserController.php

namespace App\Controller;

use App\Model\UserModel;

class UserController {
    protected $model;

    public function __construct(UserModel $model) {
        $this->model = $model;
    }

    public function index() {
        $people = $this->model->getAllUsers();
        include __DIR__ . '/../View/users.php';
    }
}

View/users.php

<h1>All Users</h1>
<ul>
    <?php foreach ($users as $user): ?>
        <li><?= htmlspecialchars($user['name']) ?> - <?= htmlspecialchars($user['email']) ?></li>
    <?php endforeach; ?>
</ul>

public/index.php

require __DIR__ . '/../vendor/autoload.php';

use Aura\Sql\ExtendedPdo;
use App\Model\PeopleModel;
use App\Controller\PeopleController;

$db = new ExtendedPdo(
    'mysql:host=localhost;dbname=gai;charset=utf8mb4',
    'gai',
    'gaipass'
);

$model = new PeopleModel($db);
$controller = new PeopleController($model);
$controller->index();

Screenshots And Screencast Walkthrough

Aura PHP Dependencies
Command Line Installation Of Aura PHP Web Framework

Aura PHP Server
Command Line Server Of Aura PHP Web Framework

Aura PHP Composer
Gnome Text Editor Displaying Composer JSON

Aura PHP Route
Gnome Text Editor Displaying App Route File

Aura PHP View
Gnome Text Editor Displaying App View File

Aura PHP People Controller
Gnome Text Editor Displaying Custom People Controller
Aura PHP People Model
Gnome Text Editor Displaying Custom People Model
Aura PHP People Result
Web Browser Displaying Custom People Route Result

Aura PHP Custom View Records In Web Browser

Learn More with My Book

If you’re just starting out, grab a copy of my beginner-friendly PHP book:

📚 Learning PHP on Amazon

Online Course Available

Want a structured video course? Enroll in my course:

🎬 Learning PHP Course

Need Help?

I offer:

  • ✅ One-on-one programming tutorials
  • 🔄 Aura PHP migration & upgrade services

📩 Contact Me Here

Summary

Aura PHP is a great way to write clean, modular PHP code using the MVC pattern. Whether you’re building a small app or learning how PHP frameworks work, this tutorial gives you a great starting point.

Feel free to leave questions in the comments, or contact me directly for help!

About Edward

Edward is a software engineer, web developer, and author dedicated to helping people achieve their personal and professional goals through actionable advice and real-world tools.

As the author of impactful books including Learning JavaScript, Learning Python, Learning PHP, Mastering Blender Python API, and fiction The Algorithmic Serpent, Edward writes with a focus on personal growth, entrepreneurship, and practical success strategies. His work is designed to guide, motivate, and empower.

In addition to writing, Edward offers professional "full-stack development," "database design," "1-on-1 tutoring," "consulting sessions,", tailored to help you take the next step. Whether you are launching a business, developing a brand, or leveling up your mindset, Edward will be there to support you.

Edward also offers online courses designed to deepen your learning and accelerate your progress. Explore the programming on languages like JavaScript, Python and PHP to find the perfect fit for your journey.

📚 Explore His Books – Visit the Book Shop to grab your copies today.
💼 Need Support? – Learn more about Services and the ways to benefit from his expertise.
🎓 Ready to Learn? – Check out his Online Courses to turn your ideas into results.

Leave a Reply

Your email address will not be published. Required fields are marked *