https://github.com/upfor/upforphp
A micro PHP framework
https://github.com/upfor/upforphp
framework php
Last synced: about 13 hours ago
JSON representation
A micro PHP framework
- Host: GitHub
- URL: https://github.com/upfor/upforphp
- Owner: upfor
- License: mit
- Created: 2016-05-03T09:28:00.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-06-15T07:20:24.000Z (almost 10 years ago)
- Last Synced: 2025-12-14T06:45:33.082Z (4 months ago)
- Topics: framework, php
- Language: PHP
- Homepage:
- Size: 44.9 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# [Upfor Framework](http://framework.upfor.club)
Upfor is a simple, extensible framework for PHP. Upfor can help you quickly build simple yet powerful web applications.
## Installation
### 1. Download the files
If you’re using [Composer](https://getcomposer.org), you can run the following command:
```
composer require upfor/upforphp
```
OR you can [download](https://github.com/upfor/upforphp/archive/master.zip) them directly and extract them to your web directory.
### 2. Configure webserver
#### PHP built-in server
```
php -S 0.0.0.0:8080 -t ./public
```
#### Apache configuration
Make sure your Apache virtual host is configured with the `AllowOverride` option. Ensure your `.htaccess` file and contain this code:
```
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]
```
#### Nginx configuration
For Nginx, add the following to your server declaration:
```
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
```
### 3. Create index.php file
First, include the autoloader and register a namespace.
```
define("ROOT", dirname(realpath(__DIR__)));
require ROOT . '/src/Autoloader.php';
$autoloader = new \Upfor\Autoloader();
$autoloader->addNamespace('Upfor\\', ROOT . '/src/');
$autoloader->register();
```
If you’re using Composer, run the autoloader instead.
```
require 'vendor/autoload.php';
```
Create and configure app.
```
$app = new \Upfor\App();
```
Define the application routes.
```
$route = $app->get('/', function () {
echo 'Hello World!';
});
```
Finaly, run the application.
```
$app->run();
```
> If you are not using the Composer, you must manually require the helpers:
> `require ROOT . '/src/Helper/helpers.php';`
## Requirements
Upfor requires PHP 5.4.0 or greater.
## License
Upfor Framework is released under the MIT license.