Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/isaka-james/master-php-framework

A PHP Framework, life made easier for vanilla PHP developers 🐘
https://github.com/isaka-james/master-php-framework

easy-to-use framework php php-framework twig vanilla-php

Last synced: about 1 month ago
JSON representation

A PHP Framework, life made easier for vanilla PHP developers 🐘

Awesome Lists containing this project

README

        


🌟 master-php 🚀



php logo Framework 🥀


since 7 March,2024


⏰ What is this? 📒


This PHP framework, lovingly crafted by Masterplan 🐘, is designed to empower vanilla PHP developers with control and responsibility over their projects. You can find more about Masterplan on GitHub 🚀.


Reasons to use master-php?


This isn't just another framework! For those who like to dive deep into their projects, this project structure is perfect for you. It offers customizable options from the database and beyond. Why not give it a try?



Oh, I forgot to mention, hosting is a breeze. Simply deploy your project to the server's root directory, and bloom 💥, it's already hosted!

## Key Features ✅

- [x] The developer has full control of everything happening!
- [x] The user can add his logic (i.e., Classes) by modifying the bootstrap files (which are well organized to be modified).
- [x] The fastness is very high and memory used is low compared to other frameworks!
- [x] The overall system is the best. (i.e., you can only see errors or do some testings if you are only on a development mode)

## Lets Write "Hello World!"
First, we need to define the route of our page. Routes are located in `app/routes/route.php `. This file,` route`, is among the bootstrap files, so you don't need to create it.

```php
// app/routes/route.php
$routes = [
'/' => 'indexController',

];

```
We defined the route '/' and passed the controller name as `indexController`. Now we need to create the controller file at the `app/controllers` directory, so we will create the file called *indexController.php* in the `app/controllers` directory.

```php
load('HelloWorld.twig');

// add your custom variable either from database or your own
$title="Hello World Website!";

// Render the template with variables
echo $template->render([

'title' => $title,
// add more as you want

]);

```
Now, as you have seen, we need to create a file named *HelloWorld.twig* at `views/home/`. To clarify, I used Twig as a renderer for HTML and PHP variables/arrays.

```twig
{# views/home/HelloWorld.twig #}


{{ title }}
{# assume you have a style at /public/css/style.css #}

Hellow World!

{# also lets assume you have scipt file at '/public/js/script', remember to add '/' before 'public/js/script' #}

```

## Running the server:
As mentioned earlier, this framework is tailored for those who seek control over their projects (*vanilla PHP*). Running the server is the same as with vanilla PHP.

### For Windows users:
```
Just put your files on your favorite server and run the server!
```

### For Linux users:
```bash
php -S localhost:8080
```

### Hosting:
```
Simply place your files in your server's root directory, typically inside '/public/www/'.
```

## Want to explore more?:
The project variables are found here `app/project.php`, here you can put the project name, contacts, show if the project is development/production/maintanance, database connection and many..

I can't cover all the intricacies here, I put alot of comments to make life easier for you. Also I highly recommend it for vanilla PHP developers to have the best experience.💪

## Contributions Needed:
I eagerly await your pull requests. If you have any ideas or logic to implement in this framework, you are warmly welcomed!

## License:
[MIT](LICENSE)