|
1 | | -# WebFiori Framework |
| 1 | +# WebFiori App Template |
2 | 2 |
|
3 | 3 | <p align="center"> |
4 | | -<img width="90px" hight="90px" src="https://webfiori.com/assets/images/favicon.png"> |
| 4 | + <img width="90px" height="90px" src="https://webfiori.com/assets/images/favicon.png" alt="WebFiori Logo"> |
5 | 5 | </p> |
6 | 6 |
|
7 | 7 | <p align="center"> |
8 | | - <a href="https://github.com/WebFiori/framework/actions"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%208.2/badge.svg?branch=master"></a> |
9 | | - <a href="https://codecov.io/gh/WebFiori/framework"> |
10 | | - <img src="https://codecov.io/gh/WebFiori/framework/branch/master/graph/badge.svg" /> |
11 | | - </a> |
12 | | - <a href="https://sonarcloud.io/dashboard?id=WebFiori_framework"> |
13 | | - <img src="https://sonarcloud.io/api/project_badges/measure?project=WebFiori_framework&metric=alert_status" /> |
14 | | - </a> |
15 | | - <a href="https://github.com/WebFiori/framework/releases"> |
16 | | - <img src="https://img.shields.io/github/release/WebFiori/framework.svg?label=latest" /> |
17 | | - </a> |
18 | | - <a href="https://packagist.org/packages/webfiori/framework"> |
19 | | - <img src="https://img.shields.io/packagist/dt/webfiori/framework?color=light-green"> |
20 | | - </a> |
| 8 | + <a href="https://github.com/WebFiori/app/actions"><img src="https://github.com/WebFiori/app/workflows/PHP%20Build/badge.svg?branch=main" alt="Build Status"></a> |
| 9 | + <a href="https://github.com/WebFiori/app/releases"><img src="https://img.shields.io/github/release/WebFiori/app.svg?label=latest" alt="Latest Release"></a> |
| 10 | + <a href="https://packagist.org/packages/webfiori/app"><img src="https://img.shields.io/packagist/dt/webfiori/app?color=light-green" alt="Downloads"></a> |
21 | 11 | </p> |
22 | 12 |
|
23 | | -## What is WebFiori Framework? |
| 13 | +The default application template for [WebFiori Framework](https://github.com/WebFiori/framework). Use this as a starting point to create new WebFiori projects. |
24 | 14 |
|
25 | | -WebFiori Framework is a mini web development framework which is built using PHP language. The framework is fully object-oriented (OOP). It uses semi-MVC model, but it does not force it. The framework comes with many features which can help in making your website or web application up and running in no time. |
| 15 | +## Requirements |
26 | 16 |
|
27 | | -## Supported PHP Versions |
28 | | -| Build Status | |
29 | | -|:-----------:| |
30 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php70.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%207.0/badge.svg?branch=master"></a>| |
31 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php71.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%207.1/badge.svg?branch=master"></a>| |
32 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php72.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%207.2/badge.svg?branch=master"></a>| |
33 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php73.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%207.3/badge.svg?branch=master"></a>| |
34 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php74.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%207.4/badge.svg?branch=master"></a>| |
35 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php80.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%208.0/badge.svg?branch=master"></a>| |
36 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php81.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%208.1/badge.svg?branch=master"></a>| |
37 | | -|<a target="_blank" href="https://github.com/WebFiori/framework/actions/workflows/php82.yml"><img src="https://github.com/WebFiori/framework/workflows/Build%20PHP%208.2/badge.svg?branch=master"></a><br>| |
| 17 | +- PHP >= 8.1 |
| 18 | +- [Composer](https://getcomposer.org/) |
38 | 19 |
|
| 20 | +## Quick Start |
39 | 21 |
|
40 | | -## Key Features |
| 22 | +```bash |
| 23 | +composer create-project webfiori/app my-site |
| 24 | +cd my-site |
| 25 | +php -S localhost:8080 -t public |
| 26 | +``` |
41 | 27 |
|
42 | | -* Provide minimum utilities to setup a small/medium web application. |
43 | | -* Theming and the ability to create multiple UIs for the same web app using any CSS or JavaScript framework. |
44 | | -* Building and manipulating the DOM of a web page inside PHP. |
45 | | -* Basic template engine. |
46 | | -* Fast and simple routing engine. |
47 | | -* Creation of web services (or APIs) that supports JSON with data filtering and validation. |
48 | | -* Middleware support for HTTP requests filtering before reaching application level. |
49 | | -* Basic support for MySQL and MSSQL schema and query building. |
50 | | -* Lightweight. The total size of framework core files is less than 3 megabytes. |
51 | | -* Access management by assigning system user a set of privileges. |
52 | | -* Customized sessions manager. |
53 | | -* Support for creating and sending nice-looking HTML emails. |
54 | | -* Autoload of user defined classes (loading composer packages also supported). |
55 | | -* Ability to create background tasks and let them run in specific time using CRON. |
56 | | -* Well-defined file upload and file handling sub-system. |
57 | | -* Basic support for creating CLI Applications. |
| 28 | +Then open http://localhost:8080 in your browser. |
58 | 29 |
|
59 | | -## Standard Libraries |
| 30 | +## Project Structure |
60 | 31 |
|
61 | | -Following table shows build status of the standard libraries that the framework is composed of. The build is based on the latest stable PHP release. |
| 32 | +``` |
| 33 | +├── public/ # Web server document root |
| 34 | +│ ├── index.php # Application entry point |
| 35 | +│ ├── .htaccess # Apache rewrite rules |
| 36 | +│ ├── web.config # IIS rewrite rules |
| 37 | +│ └── assets/ # Static files (CSS, JS, images) |
| 38 | +├── tests/ # PHPUnit tests |
| 39 | +│ ├── bootstrap.php # Test bootstrap |
| 40 | +│ └── phpunit.xml # PHPUnit configuration |
| 41 | +├── composer.json |
| 42 | +├── php_cs.php.dist # PHP CS Fixer configuration |
| 43 | +├── webfiori # CLI entry point (Linux/macOS) |
| 44 | +└── webfiori.bat # CLI entry point (Windows) |
| 45 | +``` |
62 | 46 |
|
63 | | -| Library | Build | Latest | |
64 | | -|----|----|----| |
65 | | -| [HTTP](https://github.com/WebFiori/http) | <a href="https://github.com/WebFiori/http/actions"><img src="https://github.com/WebFiori/http/workflows/Build%20PHP%208.2/badge.svg?branch=master"></a> | <a href="https://github.com/WebFiori/http/releases"><img src="https://img.shields.io/github/release/WebFiori/http.svg" /></a> | |
66 | | -| [File](https://github.com/WebFiori/file) | <a href="https://github.com/WebFiori/file/actions"><img src="https://github.com/WebFiori/file/workflows/Build%20PHP%208.2/badge.svg?branch=main"></a> | <a href="https://github.com/WebFiori/file/releases"><img src="https://img.shields.io/github/release/WebFiori/file.svg" /></a> | |
67 | | -| [Json](https://github.com/WebFiori/json) | <a href="https://github.com/WebFiori/json/actions"><img src="https://github.com/WebFiori/json/workflows/Build%20PHP%208.2/badge.svg?branch=master"></a> | <a href="https://github.com/WebFiori/json/releases"><img src="https://img.shields.io/github/release/WebFiori/json.svg" /></a> | |
68 | | -| [UI](https://github.com/WebFiori/ui) | <a href="https://github.com/WebFiori/ui/actions"><img src="https://github.com/WebFiori/ui/workflows/Build%20PHP%208.2/badge.svg?branch=master"></a> | <a href="https://github.com/WebFiori/ui/releases"><img src="https://img.shields.io/github/release/WebFiori/ui.svg" /></a> | |
69 | | -| [Collections](https://github.com/WebFiori/collections) | <a href="https://github.com/WebFiori/collections/actions"><img src="https://github.com/WebFiori/collections/workflows/Build%20PHP%208.2/badge.svg?branch=master"></a> | <a href="https://github.com/WebFiori/collections/releases"><img src="https://img.shields.io/github/release/WebFiori/collections.svg" /></a> | |
70 | | -| [Database](https://github.com/WebFiori/database) | <a href="https://github.com/WebFiori/database/actions"><img src="https://github.com/WebFiori/database/workflows/Build%20PHP%208.2/badge.svg?branch=main"></a> | <a href="https://github.com/WebFiori/database/releases"><img src="https://img.shields.io/github/release/WebFiori/database.svg" /></a> | |
71 | | -| [CLI](https://github.com/WebFiori/cli) | <a href="https://github.com/WebFiori/cli/actions"><img src="https://github.com/WebFiori/cli/workflows/Build%20PHP%208.2/badge.svg?branch=main"></a> | <a href="https://github.com/WebFiori/cli/releases"><img src="https://img.shields.io/github/release/WebFiori/cli.svg" /></a> | |
72 | | -| [Mailer](https://github.com/WebFiori/mail) | <a href="https://github.com/WebFiori/mail/actions"><img src="https://github.com/WebFiori/err/workflows/Build%20PHP%208.2/badge.svg?branch=main"></a> | <a href="https://github.com/WebFiori/mail/releases"><img src="https://img.shields.io/github/release/WebFiori/mail.svg" /></a> | |
73 | | -| [Errors and Exceptions Handler](https://github.com/WebFiori/err) | <a href="https://github.com/WebFiori/err/actions"><img src="https://github.com/WebFiori/err/workflows/Build%20PHP%208.2/badge.svg?branch=main"></a> | <a href="https://github.com/WebFiori/err/releases"><img src="https://img.shields.io/github/release/WebFiori/err.svg" /></a> | |
| 47 | +After running `composer create-project`, the framework will generate an `App/` directory containing your application code (routes, middleware, commands, etc.). |
74 | 48 |
|
75 | | -## Problems Solved |
| 49 | +## Customizing the App Directory |
76 | 50 |
|
77 | | -One of the things that any developer cares about any software project is the problem or problems it solves. As for WebFiori framework, It can help in solving the following problems: |
78 | | -* The ability to create a customized links to web pages as needed by using [Routing](https://webfiori.com/learn/routing). |
79 | | -* No need for touching HTML to play with the DOM by using [UI Library](https://webfiori.com/learn/ui-package) of the framework. |
80 | | -* Run PHP code as a CRON task through HTTP protocol or through terminal as a [Background Job](https://webfiori.com/learn/background-tasks). |
81 | | -* Changing whole user interface by changing one line of code through [Theming](https://webfiori.com/learn/themes). |
82 | | -* Ability to move the source code of the web application without having to do a lot of re-configuration. |
83 | | -* [Sending HTML email](https://webfiori.com/learn/sending-emails) messages with attachments without having to write a lot of code. |
84 | | -* Solved the issues which are found in default PHP session management implementation by implementing a custom [Sessions Management System](https://webfiori.com/learn/sessions-management). |
85 | | -* Reduce the number of dependencies at which a developer need to set up a web application. |
| 51 | +By default, the framework uses `App/` as the application root directory. To change this, edit the first parameter of `App::initiate()` in `public/index.php`: |
86 | 52 |
|
87 | | -## Getting Started |
| 53 | +```php |
| 54 | +App::initiate('MyApp', 'public', __DIR__); |
| 55 | +``` |
88 | 56 |
|
89 | | -To learn the basics of how to use the framework, please head on to https://webfiori.com/learn. You can also read same docs which can be found in [docs repo](https://github.com/usernane/wf-docs). In addition to that, you can read the API docs of the framework at [the official website](https://webfiori.com/docs). |
| 57 | +Reasons you might want to rename it: |
90 | 58 |
|
| 59 | +- Gives your project a distinct identity instead of a generic `App/` folder. |
| 60 | +- Avoids naming conflicts if you're integrating WebFiori into an existing project that already has an `App/` directory. |
| 61 | +- Makes it easier to distinguish between multiple WebFiori-based projects in the same workspace. |
91 | 62 |
|
92 | | -## Setup |
| 63 | +## Running Tests |
93 | 64 |
|
94 | | -### Local Development Environment |
| 65 | +```bash |
| 66 | +composer test |
| 67 | +``` |
95 | 68 |
|
96 | | -If you plan to test the framework on your local machine, the recommended way is to have AMP stack (Apache, MySQL and PHP). There are many available online. We suggest to use the ones that are offered by Bitnami. You can go to https://bitnami.com/stacks/infrastructure to check the available options. |
| 69 | +## Code Style |
97 | 70 |
|
98 | | -After installing AMP stack, you can either use composer to install the framework or install it manually by download it through https://webfiori.com/download. If you plan to use composer, then you must first download composer from their website: https://getcomposer.org/download/. Once downloaded, place the `.phar` file in the folder `htdocs` or your server root. Once you do that, run the terminal in `htdocs` and run the following command: |
| 71 | +This project uses [PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) for code style enforcement. |
99 | 72 |
|
| 73 | +```bash |
| 74 | +composer cs-check # Check for violations (dry run) |
| 75 | +composer cs-fix # Auto-fix violations |
100 | 76 | ``` |
101 | | -php composer.phar create-project --prefer-dist webfiori/app my-site |
| 77 | + |
| 78 | +## CLI Usage |
| 79 | + |
| 80 | +WebFiori includes a CLI tool for common tasks: |
| 81 | + |
| 82 | +```bash |
| 83 | +# Linux/macOS |
| 84 | +php webfiori |
| 85 | + |
| 86 | +# Windows |
| 87 | +webfiori.bat |
102 | 88 | ``` |
103 | | -This command will create new folder with the name `my-site` and install the framework inside it. |
104 | 89 |
|
105 | | -For more information about how to set up the framework, [check here](https://webfiori.com/learn/installation). |
| 90 | +## Documentation |
| 91 | + |
| 92 | +- [Getting Started](https://webfiori.com/learn) |
| 93 | +- [API Reference](https://webfiori.com/docs) |
| 94 | +- [Framework Repository](https://github.com/WebFiori/framework) |
106 | 95 |
|
| 96 | +## Contributing |
107 | 97 |
|
108 | | -## Contribution |
| 98 | +For information on how to contribute, see [the contribution guide](https://webfiori.com/contribute). |
109 | 99 |
|
110 | | -For information on how to contribute to the project, [check here](https://webfiori.com/contribute). |
| 100 | +## Reporting Issues |
111 | 101 |
|
112 | | -## Notes |
113 | | -* If you think that there is a better way of doing things or wants new feature, feel free to [drop an issue](https://github.com/WebFiori/framework/issues/new). |
114 | | -* To report security vulnerabilities, please email [ibrahim@webfiori.com](mailto:ibrahim@webfiori.com). |
| 102 | +- For bugs and feature requests, [open an issue](https://github.com/WebFiori/app/issues/new). |
| 103 | +- For security vulnerabilities, please email [ibrahim@webfiori.com](mailto:ibrahim@webfiori.com). |
115 | 104 |
|
116 | 105 | ## License |
117 | 106 |
|
118 | | -The project is licensed under MIT license. |
| 107 | +This project is licensed under the [MIT License](LICENSE). |
0 commit comments