PHPackages                             marwanalsoltany/velox - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. marwanalsoltany/velox

ActiveProject[Framework](/categories/framework)

marwanalsoltany/velox
=====================

The minimal PHP micro-framework.

v1.5.8(3y ago)581421MITPHPPHP ^7.4 || ^8.0

Since Apr 12Pushed 3y ago3 watchersCompare

[ Source](https://github.com/MarwanAlsoltany/velox)[ Packagist](https://packagist.org/packages/marwanalsoltany/velox)[ Docs](https://github.com/MarwanAlsoltany/velox/blob/master/README.md)[ Fund](https://ko-fi.com/marwanalsoltany)[ RSS](/packages/marwanalsoltany-velox/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (32)Used By (0)

[![VELOX](https://raw.githubusercontent.com/MarwanAlsoltany/velox/master/themes/velox/assets/images/velox-logo.png)](https://raw.githubusercontent.com/MarwanAlsoltany/velox/master/themes/velox/assets/images/velox-logo.png)

---

VELOX
=====

[](#velox)

The fastest way to build simple websites using PHP!

[![PHP Version](https://camo.githubusercontent.com/08c6f5e6876a1caf04a475b1448a02b8d5ddebcc15d54f177abadf29993732ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e342d79656c6c6f773f7374796c653d666c6174266c6f676f3d706870)](https://github.com/MarwanAlsoltany/velox/search?l=php)[![Latest Version on Packagist](https://camo.githubusercontent.com/033a716c146e29a83ab5eb7caace96d1520a112536c15695e6a3e94d80d48d5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617277616e616c736f6c74616e792f76656c6f782e7376673f7374796c653d666c6174266c6f676f3d7061636b6167697374)](https://packagist.org/packages/marwanalsoltany/velox)[![Total Downloads](https://camo.githubusercontent.com/d83ec02976fff38bfb901d6d206f90423ce530e2d6f380548be5a7e9b6a538ad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617277616e616c736f6c74616e792f76656c6f782e7376673f7374796c653d666c6174266c6f676f3d7061636b6167697374)](https://packagist.org/packages/marwanalsoltany/velox/stats)[![License](https://camo.githubusercontent.com/8e5bdeb25cec99ef8c5345207c75dcab39dc539399bd321e9f4e73396b581686/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d7265642e7376673f7374796c653d666c6174266c6f676f3d676974687562)](./LICENSE)[![Maintenance](https://camo.githubusercontent.com/068fd45ce0e3bc55bc753945ee21519d011ea319c92d060f0a62eac52e76f54e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6d61696e7461696e65642d7965732d6f72616e67652e7376673f7374796c653d666c6174266c6f676f3d676974687562)](https://github.com/MarwanAlsoltany/velox/graphs/commit-activity)[![Documentation](https://camo.githubusercontent.com/9f3a84a9c9dd8af9c41dc9407452db410b742cfeb382db30917995eeb634c1de/68747470733a2f2f696d672e736869656c64732e696f2f776562736974652d75702d646f776e2d626c75652d7265642f687474702f6d617277616e616c736f6c74616e792e636f6d2f76656c6f782e737667)](https://marwanalsoltany.github.io/velox)[![Scrutinizer Build Status](https://camo.githubusercontent.com/ff1278557b8077f1ebf35777b3debdc97c835451ec5713c58e4ac45bc7652942/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f4d617277616e416c736f6c74616e792f76656c6f782f6d61737465723f7374796c653d666c6174266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/MarwanAlsoltany/velox/build-status/master)[![Scrutinizer Code Coverage](https://camo.githubusercontent.com/24b7d3d0185969d4fc34180679bbb5873f43c20bba9a6e3bcfff9d1b7a122af6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f4d617277616e416c736f6c74616e792f76656c6f782e7376673f7374796c653d666c6174266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/MarwanAlsoltany/velox/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/f94633a0055153eb738c719ea0f107466f2716f2378ea8ce99d63fbecc26c298/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4d617277616e416c736f6c74616e792f76656c6f782e7376673f7374796c653d666c6174266c6f676f3d7363727574696e697a6572)](https://scrutinizer-ci.com/g/MarwanAlsoltany/velox/?branch=maste)[![Travis Build Status](https://camo.githubusercontent.com/821ae6a4d52c69b4e09b10f3026d054eb34d4ac31aa2950348f56f3375112e12/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f4d617277616e416c736f6c74616e792f76656c6f782f6d61737465722e7376673f7374796c653d666c6174266c6f676f3d747261766973)](https://travis-ci.com/MarwanAlsoltany/velox)[![StyleCI Code Style](https://camo.githubusercontent.com/3c8c2f409797876e00cfa412622ee05b557a46f2a5d187cfcf5ca721cc569ec1/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3335363531353830312f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://github.styleci.io/repos/356515801)

[![Open in Visual Studio Code](https://camo.githubusercontent.com/821a60ac3a234e9dfc8569606ae5c68c932b15215af5b0a5e73715e3aae8a78e/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6f676f3d76697375616c73747564696f636f6465266c6162656c3d266d6573736167653d4f70656e253230696e2532305653253230436f6465266c6162656c436f6c6f723d32633263333226636f6c6f723d303037616363266c6f676f436f6c6f723d303037616363)](https://open.vscode.dev/MarwanAlsoltany/velox) [![Run on Repl.it](https://camo.githubusercontent.com/e90a12e02d77c91473cf4a8f9c832c3c560bd887971cc70a6b4129e19694150a/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6f676f3d7265706c6974266c6162656c3d266d6573736167653d52756e2532306f6e2532305265706c6974266c6162656c436f6c6f723d30653135323526636f6c6f723d666666666666266c6f676f436f6c6f723d666666666666)](https://replit.com/@marwanalsoltany/velox)

[![Tweet](https://camo.githubusercontent.com/cb820a0ecc9645168e33b03925d7f14691262ddbaeaf66a0a91697803d0cba2d/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f687474702f736869656c64732e696f2e7376673f7374796c653d736f6369616c)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2FMarwanAlsoltany%2Fvelox&text=The%20fastest%20way%20to%20build%20simple%20websites%20using%20%23PHP%21) [![Star](https://camo.githubusercontent.com/24f29e1dc40356e85c9e2b4c03b17da3c4cc83807e3f5447cb033fbdc4d613e3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f4d617277616e416c736f6c74616e792f76656c6f782e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/MarwanAlsoltany/velox/stargazers)

Table of Contents[Installation](#installation)
[About VELOX](#about-velox)
[Architecture](#architecture)
[Config](#config)
[Classes](#classes)
[Functions](#functions)
[Commands](#commands)
[Themes](#themes)
[Extending VELOX](#extending-velox)
[MVC](#mvc)
[Templating](#templating)
[Authentication](#authentication)
[Changelog](./CHANGELOG.md)
[Documentation](https://marwanalsoltany.com/velox)

If you like this project and would like to support its development, giving it a ⭐ would be appreciated!

[![VELOX Demo](https://user-images.githubusercontent.com/7969982/133680020-48b64343-eb6e-4519-b1ba-adc86737c184.jpeg)](https://velox.marwanalsoltany.repl.co)Check out the [**Demo**](https://velox.marwanalsoltany.repl.co) or play with the [**REPL**](https://replit.com/@MarwanAlsoltany/velox).

Do you feel like reading? Check out the full API on the documentation website on [`marwanalsoltany.github.io/velox`](https://marwanalsoltany.github.io/velox).

---

Key Features
------------

[](#key-features)

1. Zero dependencies
2. Minimal, intuitive and easy to get along with
3. Unlimited flexibility when it comes to customizing it to your exact needs

---

Installation
------------

[](#installation)

#### Using Composer:

[](#using-composer)

```
composer create-project marwanalsoltany/velox my-velox-app
```

[![RED](https://camo.githubusercontent.com/6695376bedba7b210787dc4ff77b7c39554fe87c54dc7127a9d274ffe12deff5/68747470733a2f2f66616b65696d672e706c2f31312f6630336331352f3030303030303f746578743d2b)](https://camo.githubusercontent.com/6695376bedba7b210787dc4ff77b7c39554fe87c54dc7127a9d274ffe12deff5/68747470733a2f2f66616b65696d672e706c2f31312f6630336331352f3030303030303f746578743d2b) **Note:** *You may need to add the `--stability=dev` depending on the version/branch. You may also want to add `--no-dev` flag to not install development dependencies.*

#### Using Git:

[](#using-git)

```
git clone https://github.com/MarwanAlsoltany/velox.git my-velox-app
```

[![BLUE](https://camo.githubusercontent.com/8de3868d863888f4c87303f76116d246520d13cc256b06a76fd6396605097a9b/68747470733a2f2f66616b65696d672e706c2f31312f3165393066662f3030303030303f746578743d2b)](https://camo.githubusercontent.com/8de3868d863888f4c87303f76116d246520d13cc256b06a76fd6396605097a9b/68747470733a2f2f66616b65696d672e706c2f31312f3165393066662f3030303030303f746578743d2b) **Fact:** *If you don't want to use any other third party packages. Installing VELOX using Git is sufficient.*

#### Using Source:

[](#using-source)

Download [VELOX](https://github.com/MarwanAlsoltany/velox/releases) as a `.zip` or `.tar.gz` and extract it in your server web root directory.

[![GREEN](https://camo.githubusercontent.com/4a40c9d89b4bd79e37e923af7ddf7163bb3520d24cc4d2c2b91f9fcc20d837a0/68747470733a2f2f66616b65696d672e706c2f31312f3332636433322f3030303030303f746578743d2b)](https://camo.githubusercontent.com/4a40c9d89b4bd79e37e923af7ddf7163bb3520d24cc4d2c2b91f9fcc20d837a0/68747470733a2f2f66616b65696d672e706c2f31312f3332636433322f3030303030303f746578743d2b) **Advice:** *If you want to test out VELOX quickly and you don't have any web server available, use whatever installing method and run `php bin/app-serve` from inside VELOX directory. This command will spin up a development web server on `localhost:8000` (Note that you need to have at least PHP installed on your system).*

---

About VELOX
-----------

[](#about-velox)

VELOX is a lightweight micro-framework that makes creating a simple website using PHP joyful. It helps you create future-proof websites faster and more efficiently. It provides components that facilitate the process of creating a website using PHP. VELOX does not have any dependencies, the VELOX package and everything that it needs is included in the project itself. All that VELOX provides is a way to work with **config**, pass **data**, register **routes**, interact with the **database**, render **views**, handle **exceptions**, **autoload** code, and **resolve** assets. It provides the *View* and the *Controller* parts of an *MVC* design pattern. Staring from `v1.3.0`, VELOX also provides the *Model* part, making it a fully featured *MVC* framework and starting from `v1.4.0` it also comes shipped with a simple authentication system. VELOX can also be used as a **Static Site Generator** if all you need is HTML files in the end.

### Why does VELOX exist?

[](#why-does-velox-exist)

VELOX was created to solve a specific problem, it's a way to build a website that is between dynamic and static, a way to create a simple website with few pages without being forced to use a framework or a CMS that comes with a ton of stuff which will never get used, it's lightweight, minimal, and straight to the point.

It's not recommended to use VELOX if you have an intermediary project, you would be better off using a well-established framework. VELOX is not an initiative to reinvent the wheel, you can look at VELOX as a starter-kit for small projects.

VELOX has a very special use-case, simple websites, and here is meant really simple websites. The advantage is, you don't have stuff that you don't need. Comparing VELOX to Laravel or Symfony is irrelevant, as these frameworks play in a totally different area, it also worth mentioning that VELOX is much simpler than Lumen or Slim.

---

Architecture
------------

[](#architecture)

### Directory structure

[](#directory-structure)

DirectoryDescription[`bootstrap`](./bootstrap)This is where VELOX bootstraps the application. You normally don't have to change anything in this directory, unless you want to extend VELOX functionality beyond basic stuff.[`bin`](./bin)This is where PHP executables are placed. You can freely add yours, or delete the entire directory.[`app`](./app)This is where your own backend logic will be placed. You will be mostly working here for the backend part of your app.[`classes`](./classes)This is where VELOX source files live. You shouldn't be touching anything here unless you want to make your own version of VELOX.[`functions`](./functions)This is where all functions that are loaded in the application live. You can freely add yours, or delete the entire directory.[`includes`](./includes)This is where all files that should be preloaded will be placed. You can freely add yours, or delete the entire directory.[`themes`](./themes)This is where all your frontend themes will be placed. You will be mostly working here for the frontend part of your app.[`config`](./config)This is where all config files will live. All files here will be accessible using the `Config` class at runtime.[`storage`](./storage)This is where VELOX will write caches and logs. You can also use this directory to store installation-wide assets.[`public`](./public)This is where you should put your `index.php` with a symlink for static assets (active theme `assets/` directory for example) for maximum security. You can freely delete this directory if you want to.[`vendor`](./vendor)This is where your Composer dependencies will be placed. You can freely delete this directory if you don't want to use Composer.[![GREEN](https://camo.githubusercontent.com/4a40c9d89b4bd79e37e923af7ddf7163bb3520d24cc4d2c2b91f9fcc20d837a0/68747470733a2f2f66616b65696d672e706c2f31312f3332636433322f3030303030303f746578743d2b)](https://camo.githubusercontent.com/4a40c9d89b4bd79e37e923af7ddf7163bb3520d24cc4d2c2b91f9fcc20d837a0/68747470733a2f2f66616b65696d672e706c2f31312f3332636433322f3030303030303f746578743d2b) **Advice:** *Most files listed in these directories are documented. Take a look through them to learn more about VELOX.*

### App Entry

[](#app-entry)

The entry point for a VELOX app is the [`index.php`](./index.php), here you need to require the [`bootstrap/autoload.php`](./bootstrap/autoload.php), register some routes with their handlers using the `Router::class`, and start the router. This is all that you need to have a working VELOX app.

```
