PHPackages                             thenrise/expr-php - 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. thenrise/expr-php

ActiveLibrary

thenrise/expr-php
=================

Super lightweight PHP RESTful API Framework

0156↓100%PHP

Since Dec 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/GustavoEklund/thin-expr-php)[ Packagist](https://packagist.org/packages/thenrise/expr-php)[ RSS](/packages/thenrise-expr-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

expr-php
========

[](#expr-php)

Getting started
---------------

[](#getting-started)

### Installation

[](#installation)

expr-php utilizes [Composer](https://getcomposer.org/) to manage its dependencies. So, before using expr-php, make sure you have Composer installed on your machine.

If the requirements are right, go ahead inside your project folder in your terminal and type the following command:

```
    composer init -y
    composer require thenrise/expr-php:dev-master
```

### Configuration

[](#configuration)

All you need to start using is create an `index.php` file in your project. For this tutorial we'll have the following directory structure:

```
expr-php-tutorial
|-- src
|   `-- Controllers
|-- vendor (created by composer)
|   `-- ...
|-- .htaccess
|-- composer.json (created by composer)
|-- composer.lock (created by composer)
|-- index.php

```

Inside your `composer.json` file make sure to configure the autoload propety, add the key `"autoload"` if necessary:

```
"autoload": {
    "psr-4": {
        "Controllers\\": "./src/Controllers/"
    }
}
```

Now, make sure your `.htaccess` file's configured to change url string into a `url` to the `$_GET` superglobal:

```
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

```

Inside your `index.php`, first you need to require the autoloader, and then import two classes: `Expr\ExprBuilder` and `Expr\Router`. After that you can start the configuration that looks like:

```
