A very basic start to your own PHP MVC framework.
- Clone the repo
- Go to the root directory in your browser to see the default view. It will display
Home Page
.
Create a new file in app/models
. Example: Contact.php
.
In app/models/Contact.php'...
class Contact
{
public $title = 'Contact Page';
}
Then in app/controllers/ContactController.php
...
class ContactController extends Controller
{
public function index()
{
$contact = $this->model('Contact');
// Loads 'app/views/pages/contact.php' and passes $title which equals 'Contact Page'.
$this->view('contact', ['title' => $contact->title]);
}
}
Finally, the $title
variable can be used in our view at app/views/pages/contact.php
...
<h1><?php echo $title; ?></h1> // Outputs 'Contact Page'
- Create a branch from the
dev
branch - Implement your new feature
- Submit a pull request to be merge in the
dev
branch
- Lansana Camara