|
| 1 | +# PhpSlides |
| 2 | + |
| 3 | +<p align="center"> |
| 4 | + <a href="https://packagist.org/packages/phpslides/framework"><img src="https://img.shields.io/packagist/dt/phpslides/framework" alt="Total Downloads"></a> |
| 5 | + <a href="https://packagist.org/packages/phpslides/framework"><img src="https://img.shields.io/packagist/v/phpslides/framework" alt="Latest Stable Version"></a> |
| 6 | + <a href="https://packagist.org/packages/phpslides/framework"><img src="https://img.shields.io/packagist/l/phpslides/framework" alt="License"></a> |
| 7 | +</p> |
| 8 | + |
| 9 | +Welcome to PhpSlides!<br> |
| 10 | +This framework is a PHP revolution, |
| 11 | +designed to provide a simple and scalable structure for developing full-stack web applications |
| 12 | +using the Model-View-Controller (MVC) architectural pattern. |
| 13 | + |
| 14 | +With PhpSlides, you can write HTML, CSS, and JavaScript in a PHP-like way, |
| 15 | +streamlining the development process and enhancing productivity. |
| 16 | + |
| 17 | +## Table of Contents |
| 18 | + |
| 19 | +- [PhpSlides](#phpslides) |
| 20 | + - [Table of Contents](#table-of-contents) |
| 21 | + - [Introduction](#introduction) |
| 22 | + - [Features](#features) |
| 23 | + - [Requirements](#requirements) |
| 24 | + - [Installation](#installation) |
| 25 | + - [Install with Composer](#install-with-composer) |
| 26 | + - [Or Clone the Repository](#or-clone-the-repository) |
| 27 | + - [Configuration](#configuration) |
| 28 | + - [.env](#env) |
| 29 | + - [configs.json](#configjson) |
| 30 | + - [Syntax](#syntax) |
| 31 | + - [Creating Web Layouts](#creating-web-layouts) |
| 32 | + - [Styling Web Layouts](#styling-web-layouts) |
| 33 | + - [Creating Web Routes](#creating-web-routes) |
| 34 | + - [Creating API Routes](#creating-api-routes) |
| 35 | + - [Directory Structure](#directory-structure) |
| 36 | + - [Documentation](#documentation) |
| 37 | + - [Contributing](#contributing) |
| 38 | + - [License](#license) |
| 39 | + - [Financial Support](#financial-support) |
| 40 | + |
| 41 | +## Introduction |
| 42 | + |
| 43 | +PhpSlides is a lightweight, easy-to-use full-stack framework that helps you build web applications quickly and efficiently. |
| 44 | +It follows the MVC architectural pattern, separating the application logic into models, views, and controllers to promote code organization and reusability. |
| 45 | + |
| 46 | +Additionally, it provides the capability to write HTML, CSS, and JavaScript in a PHP-like way, making it easier to manage and maintain your front-end and back-end code together. |
| 47 | + |
| 48 | +## Features |
| 49 | + |
| 50 | +- **Full-Stack Development**: Seamlessly integrate front-end and back-end development by writing HTML, CSS, and JavaScript in a PHP-like syntax. |
| 51 | +- **Simple Routing**: Easily define routes and map them to controllers and actions. |
| 52 | +- **Modular Structure**: Organized directory structure for models, views, controllers, and other components. |
| 53 | +- **Database Forgery**: A unique feature that allows you to manage your databases and tables using a structured directory format, automatically generating and managing schema migrations based on directory and file structures. |
| 54 | +- **AuthGuard Support**: Add authorization guard to handle authentication, logging, and other tasks. |
| 55 | + |
| 56 | +## Requirements |
| 57 | + |
| 58 | +- PHP 8.2 or higher |
| 59 | +- Composer |
| 60 | +- A web server (e.g., Apache, Nginx) |
| 61 | + |
| 62 | +## Installation |
| 63 | + |
| 64 | +### Install with Composer |
| 65 | + |
| 66 | +```bash |
| 67 | +composer create-project phpslides/phpslides ProjectName |
| 68 | +cd ProjectName |
| 69 | +``` |
| 70 | + |
| 71 | +### Or Clone the Repository |
| 72 | + |
| 73 | +1. **Clone the repository:** |
| 74 | + |
| 75 | + ```bash |
| 76 | + git clone https://github.com/phpslides/phpslides.git |
| 77 | + cd phpslides |
| 78 | + ``` |
| 79 | + |
| 80 | +2. **Install dependencies:** |
| 81 | + |
| 82 | + ```bash |
| 83 | + composer install |
| 84 | + ``` |
| 85 | + |
| 86 | +3. **Set up the web server:** |
| 87 | + |
| 88 | + Point your web server to the document root. |
| 89 | + |
| 90 | +4. **Configure the environment:** |
| 91 | + |
| 92 | + If the .env file does not exist, copy the env example configuration file and update it with your settings: |
| 93 | + |
| 94 | + ```bash |
| 95 | + cp .env.example .env |
| 96 | + ``` |
| 97 | + |
| 98 | +## Configuration |
| 99 | + |
| 100 | +### .env |
| 101 | + |
| 102 | +Edit the .env file to configure database settings, application settings, and other configurations. |
| 103 | + |
| 104 | +```bash |
| 105 | +APP_NAME=PhpSlides |
| 106 | +APP_VERSION=1.3.x |
| 107 | +APP_DEBUG=true |
| 108 | +APP_ENV=development |
| 109 | +``` |
| 110 | + |
| 111 | +### config.json |
| 112 | + |
| 113 | +Which handles the behavior of a viewing files on the web |
| 114 | + |
| 115 | +```json |
| 116 | +{ |
| 117 | + "deny": ["public/assets/*.png"], |
| 118 | + "message": { |
| 119 | + "contents": "403 | Forbidden", |
| 120 | + "components": "Errors::403", |
| 121 | + "content-type": "text/html" |
| 122 | + }, |
| 123 | + "charset": "UTF-8" |
| 124 | +} |
| 125 | +``` |
| 126 | + |
| 127 | +## Syntax |
| 128 | + |
| 129 | +### Creating Web Layouts |
| 130 | + |
| 131 | +```php |
| 132 | +<?php |
| 133 | + |
| 134 | +DOM::create('app')->root([ |
| 135 | + ['id' => 'root'], |
| 136 | + Tag::Container([], |
| 137 | + Tag::Input(['type' => 'text'], '$$name') |
| 138 | + Tag::Text([], 'Hello $$name') |
| 139 | + ) |
| 140 | +]); |
| 141 | + |
| 142 | +DOM::render('app'); |
| 143 | + |
| 144 | +?> |
| 145 | +``` |
| 146 | + |
| 147 | +### Styling Web Layouts |
| 148 | + |
| 149 | +```php |
| 150 | +<?php |
| 151 | + |
| 152 | +$style = StyleSheet::create([ |
| 153 | + 'RootStyle' => [ |
| 154 | + Style::Size => Screen::100, |
| 155 | + Style::BackgroundImage => asset('bg.png'), |
| 156 | + ], |
| 157 | + 'TextStyle' => [ |
| 158 | + Style::Color => Color::White, |
| 159 | + Style::FontSize => Font::Base, |
| 160 | + Style::FontWeight => Font::Bold |
| 161 | + ] |
| 162 | +]); |
| 163 | + |
| 164 | +export($style, 'AppStyle'); |
| 165 | + |
| 166 | +?> |
| 167 | +``` |
| 168 | + |
| 169 | +### Creating Web Routes |
| 170 | + |
| 171 | +```php |
| 172 | +<?php |
| 173 | + |
| 174 | +Route::map(POST, '/index') |
| 175 | + ->action('Controller::method') |
| 176 | + ->name('index'); |
| 177 | + |
| 178 | +?> |
| 179 | +``` |
| 180 | + |
| 181 | +### Creating API Routes |
| 182 | + |
| 183 | +```php |
| 184 | +<?php |
| 185 | + |
| 186 | +Api::v1()->define('/user', 'UserController') |
| 187 | + ->map([ |
| 188 | + '/info' => [GET, '@index'], |
| 189 | + '/{id}' => [GET, '@show'], |
| 190 | + ]) |
| 191 | + ->withGuard('auth') |
| 192 | + ->name('user'); |
| 193 | + |
| 194 | +$user_id_route = route('user::1'); |
| 195 | + |
| 196 | +?> |
| 197 | +``` |
| 198 | + |
| 199 | +## Directory Structure |
| 200 | + |
| 201 | +Here's an overview of the project directory structure: |
| 202 | + |
| 203 | +project_root/<br> |
| 204 | +├── app/<br> |
| 205 | +│ ├── Controller/<br> |
| 206 | +│ ├── Guards/<br> |
| 207 | +│ ├── Forge/<br> |
| 208 | +├── public/<br> |
| 209 | +├── src/<br> |
| 210 | +│ ├── bootstrap/<br> |
| 211 | +│ ├── configs/<br> |
| 212 | +│ ├── resources/<br> |
| 213 | +│ │ └── views/<br> |
| 214 | +├── vendor/<br> |
| 215 | +├── .env<br> |
| 216 | +├── .env.example<br> |
| 217 | +├── .htaccess<br> |
| 218 | +├── composer.json<br> |
| 219 | +├── configs.json<br> |
| 220 | +├── LICENSE<br> |
| 221 | +├── README.md<br> |
| 222 | +└── slide |
| 223 | + |
| 224 | +## Documentation |
| 225 | + |
| 226 | +For detailed documentation, including advanced usage, |
| 227 | +API references, and more, please visit our [documentation website](#). |
| 228 | + |
| 229 | +## Contributing |
| 230 | + |
| 231 | +We welcome contributions from the community! |
| 232 | +If you'd like to contribute, |
| 233 | +please follow these steps: |
| 234 | + |
| 235 | +<ol> |
| 236 | + <li>Fork the repository.</li> |
| 237 | + <li>Create a new branch (git checkout -b name/your-feature).</li> |
| 238 | + <li>Commit your changes (git commit -am 'Add a new feature').</li> |
| 239 | + <li>Push to the branch (git push origin name/your-feature).</li> |
| 240 | + <li>Create a new Pull Request.</li> |
| 241 | +</ol> |
| 242 | + |
| 243 | +## License |
| 244 | + |
| 245 | +This project is licensed under the MIT License. See the [LICENSE](https://github.com/PhpSlides/phpslides/blob/master/LICENSE) file for more details. |
| 246 | + |
| 247 | +## Financial Support |
| 248 | + |
| 249 | +Your contributions help us maintain and improve PhpSlides. |
| 250 | +If you find PhpSlides useful, please consider supporting us financially. |
| 251 | +Every bit of support goes a long way in ensuring we can continue to develop and enhance the framework. |
| 252 | + |
| 253 | +[Support Now!](https://buymeacoffee.com/dconco) |
0 commit comments