almhdy/simy

simple php mvc framework .

dev-main 2024-05-04 07:31 UTC

This package is auto-updated.

Last update: 2024-05-04 07:31:46 UTC


README

Simy is a lightweight MVC framework for PHP, designed to provide a structured and organized approach to building web applications.

Features

  • MVC Architecture: Simy follows the Model-View-Controller architectural pattern, allowing for separation of concerns and easier maintenance.
  • Routing: Define custom routes to map URLs to controller actions.
  • Database Access: Utilizes illuminate/database as the database layer for simple and flexible database interactions.
  • Composer Integration: Available on Packagist for easy installation and management.

Installation

To install the Simy MVC Framework, it's recommended to use the Composer create-project command to set up a new project from the Simy framework template.

composer create-project almhdy/simy your-project-name

This command will create a new project directory with the necessary files and directories in place.

Documentation

For detailed documentation and usage examples. coming soon !

Getting Started

Once you have installed the framework, you can start by defining your routes, creating controllers, and setting up your database connection.

Define Routes

<?php

use Almhdy\Simy\Core\Router;
use Almhdy\Simy\Controllers\HomeController;

$router = new Router();

$router->get("/", [HomeController::class, "index"]);
$router->get("/phpinfo", [HomeController::class, "info"]);

return $router;

Create Controllers

// HomeController.php

namespace App\Controllers;

class HomeController
{
    public function index()
    {
        // Your code here
    }
}

Database Access

// Example of database access

use Illuminate\Database\Capsule\Manager as Capsule;

// Initialize the database connection
$capsule = new Capsule;
$capsule->addConnection([
    'driver' => 'mysql',
    'host' => 'localhost',
    'database' => 'database',
    'username' => 'user',
    'password' => 'password',
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
    'prefix' => '',
]);
$capsule->setAsGlobal();
$capsule->bootEloquent();

// Retrieve all users from the database
$users = Capsule::table('users')->get();

Contribution

If you would like to contribute to the Simy framework, please submit a pull request on the GitHub repository.

Your contributions are greatly appreciated!

License

Simy is open-sourced software licensed under the MIT license.

Simy MVC Framework