1. Go to this page and download the library: Download eyo/fw-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// src/Model/UserModel.php - Real EyoPHP method
public function findByEmail(string $email): ?User
{
$query = "SELECT * FROM users WHERE email = :email";
$stmt = $this->db->prepare($query);
$stmt->execute(['email' => $email]);
$result = $stmt->fetch();
return $result ? User::fromArray($result) : null;
}
// EyoPHP's unique 3-level permission system
$router->addPublicRoute('GET', BASE_URL . 'about', 'Controller', 'method'); // Anyone can access
$router->addUserRoute('GET', BASE_URL . 'profile', 'Controller', 'method'); // Logged users only
$router->addAdminRoute('GET', BASE_URL . 'admin', 'Controller', 'method'); // Admins only
// Validate user registration
$validator = new Validator($_POST);
$validator->minLength(2);
if ($validator->isValid()) {
// Process registration
}
// src/Controller/AppController.php - Real method
public function homePage(): void
{
$this->renderView('home', [
'title' => 'Welcome to EyoPHP',
'message' => 'Your framework is ready!'
]);
}
namespace EyoPHP\Framework\Controller;
class ProductController
{
public function listProducts(): void
{
// Example: Get products from database
$products = [
['id' => 1, 'name' => 'Product 1', 'price' => 99.99],
['id' => 2, 'name' => 'Product 2', 'price' => 149.99]
];
$this->renderView('products/list', [
'title' => 'Our Products',
'products' => $products
]);
}
public function showProduct(int $id): void
{
// Example: Get single product
$product = ['id' => $id, 'name' => 'Product ' . $id, 'price' => 99.99];
$this->renderView('products/show', [
'title' => 'Product Details',
'product' => $product
]);
}
}