|
| 1 | + |
| 2 | +# GenyPHP Framework |
| 3 | + |
| 4 | +GenyPHP is a lightweight, easy-to-use PHP framework designed for building web applications quickly and efficiently. |
| 5 | + |
| 6 | +## Installation |
| 7 | + |
| 8 | +1. **Clone the Repository** |
| 9 | + ```sh |
| 10 | + git clone https://github.com/yourusername/GenyPHP.git |
| 11 | + ``` |
| 12 | + |
| 13 | +2. **Navigate to the Project Directory** |
| 14 | + ```sh |
| 15 | + cd GenyPHP |
| 16 | + ``` |
| 17 | + |
| 18 | +3. **Install Dependencies** |
| 19 | + Make sure you have [Composer](https://getcomposer.org/) installed, then run: |
| 20 | + ```sh |
| 21 | + composer install |
| 22 | + ``` |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +1. **Setting Up Routes** |
| 27 | + Define your routes in `App/Routes/routes.php`. Example: |
| 28 | + ```php |
| 29 | + use GenyPhp\Routers\Router; |
| 30 | + |
| 31 | + $router = new Router(); |
| 32 | + $router->add('GET', '/home', 'App\Controllers\HomeController', 'index'); |
| 33 | + $router->dispatch(); |
| 34 | + ``` |
| 35 | + |
| 36 | +2. **Creating Controllers** |
| 37 | + Place your controllers in `App/Controllers`. Example `HomeController.php`: |
| 38 | + ```php |
| 39 | + namespace App\Controllers; |
| 40 | + use GenyPhp\Controllers\Controller; |
| 41 | + |
| 42 | + class HomeController extends Controller { |
| 43 | + public function index() { |
| 44 | + $data = ['title' => 'Welcome to GenyPHP!']; |
| 45 | + $this->render('index', $data); |
| 46 | + } |
| 47 | + } |
| 48 | + ``` |
| 49 | + |
| 50 | +3. **Creating Views** |
| 51 | + Store your views in `App/Views`. Example `Home/index.php`: |
| 52 | + ```html |
| 53 | + <!DOCTYPE html> |
| 54 | + <html lang="en"> |
| 55 | + <head> |
| 56 | + <meta charset="UTF-8"> |
| 57 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 58 | + <title><?=$title?></title> |
| 59 | + <!-- Add your stylesheets here --> |
| 60 | + </head> |
| 61 | + <body> |
| 62 | + <h1>Welcome to GenyPHP!</h1> |
| 63 | + <p><?=$title?></p> |
| 64 | + <!-- Your content goes here --> |
| 65 | + </body> |
| 66 | + </html> |
| 67 | + ``` |
| 68 | + |
| 69 | +4. **Public Directory** |
| 70 | + Access your application through the `public` directory in the `App` folder. |
| 71 | + |
| 72 | +## Contributing |
| 73 | + |
| 74 | +Contributions are welcome! Please feel free to submit a pull request or create an issue for any bugs or feature requests. |
| 75 | + |
| 76 | +## License |
| 77 | + |
| 78 | +This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details. |
0 commit comments