PHPackages                             falco442/slim-token-auth-mvc - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. falco442/slim-token-auth-mvc

AbandonedLibrary[HTTP &amp; Networking](/categories/http)

falco442/slim-token-auth-mvc
============================

A Slim Framework skeleton to build REST API with token autentication

v1.1.1(9y ago)232[1 issues](https://github.com/falco442/slim-token-auth-mvc/issues)MITPHPPHP &gt;=5.5.0

Since Oct 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/falco442/slim-token-auth-mvc)[ Packagist](https://packagist.org/packages/falco442/slim-token-auth-mvc)[ Docs](https://github.com/falco442/slim-token-auth-mvc)[ RSS](/packages/falco442-slim-token-auth-mvc/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (6)Versions (4)Used By (0)

**Note**: this application is under development

Slim Framework 3 with Token Authentication
==========================================

[](#slim-framework-3-with-token-authentication)

use this application (derived from the slim/slim-skeleton) to develop a REST json api application with token based authentication

Install the Application
-----------------------

[](#install-the-application)

Run this command from the directory in which you want to install your new application.

```
composer create-project falco442/slim-token-auth-mvc [app-name]

```

To run the application in development, you can also run this command.

```
composer start

```

Run this command to run the test suite

```
composer test

```

Configuration
=============

[](#configuration)

Database configuration
----------------------

[](#database-configuration)

This application uses the `Illuminate\Database\Capsule\Manager` (see [api](https://laravel.com/api/5.1/Illuminate/Database/Capsule/Manager.html)) provided with Laravel as ORM.

You can config the DB in the `src/settings.php` for the connection. The connection provider is already configured in `src/dependencies.php`.

CORS
----

[](#cors)

In order to make the application able to accept CORS (Cross Origin Site Request), I added the [Tuupola cors-middleware](https://github.com/tuupola/cors-middleware). It's already configured in the file `src/middleware.php`.

Settings
--------

[](#settings)

Modify the `settings.php` file to make application work:

```
return [
    'settings' => [
        '...',
        'determineRouteBeforeAppMiddleware'=>true, //Allows to catch the route from middleware

        'db' => [			// Pass the DB configuration
            'driver' => 'mysql',
            'host' => 'localhost',
            'database' => 'db_test',
            'username' => 'test',
            'password' => 'test',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ],
        'auth'=>[
            'table' => 'users',	// the table in which you can find users to authenticate
            'salt'  => 'asdasdkhkhuilyuhg1i8y9p78olil',	// the custom salt to hash the passwords
            'allowed_routes'=>[
                'POST'=>[
                	'/login', 	// to allow login
                	'/users'	// to allow adding a user
                ]
            ],
            'fields'=>[
                'username'=>'username',		// you can set anything you want.. like 'username' => 'email' if you want to login users by email
                'password'=>'password'		// same thing as above
            ]
        ],
        '...'
    ],
];
```

Use
===

[](#use)

Controllers
-----------

[](#controllers)

This application is alreaady configured with a base `Controller` class, to work as a little MVC. See the file `src/Controller/UsersController.php` as an example.

Login
-----

[](#login)

To to the login of the user, place a route in routes.php like this (I'm using `UsersController` as example)

```
$app->any('/login', '\App\Controller\UsersController:login');
```

and so the action `login` of the `UsersController` will be invoked. Use the `authenticate()` method of the class `TokenAuth`, as this

```
public function login($request,$response,$args){
	return $response->withJSON($this->Auth->authenticate($request));
}
```

Pass in the body of the request the login fields, as you set in the `settings` array

and the `authenticate` method will return a user array if user exists, and `false` otherwise. If everything was OK, `TokenAuth` will refresh token and the field `token_created`

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3550d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11598209?v=4)[Marco Francaviglia](/maintainers/falco442)[@falco442](https://github.com/falco442)

---

Top Contributors

[![falco442](https://avatars.githubusercontent.com/u/11598209?v=4)](https://github.com/falco442 "falco442 (21 commits)")

---

Tags

restmicroframework

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/falco442-slim-token-auth-mvc/health.svg)

```
[![Health](https://phpackages.com/badges/falco442-slim-token-auth-mvc/health.svg)](https://phpackages.com/packages/falco442-slim-token-auth-mvc)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
