PHPackages                             samuelr/slim3-authentication - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. samuelr/slim3-authentication

ActiveProject[Authentication &amp; Authorization](/categories/authentication)

samuelr/slim3-authentication
============================

Slim3 Session-Based Authentication

215[1 issues](https://github.com/SamuelRoberto/slim3-authentication/issues)PHP

Since Jul 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/SamuelRoberto/slim3-authentication)[ Packagist](https://packagist.org/packages/samuelr/slim3-authentication)[ RSS](/packages/samuelr-slim3-authentication/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Slim3 Session-Based Authentication
==================================

[](#slim3-session-based-authentication)

This project is a start point if you need to connect Slim3 with a secure Session-Based authentication. In this codebase you will find a complete skeleton that contains: Slim3 Framework, Twig View, MySQL Database(for users), both Bootstrap3 and FontAwesome implemented.

**Why I created this project?**

I had to create an application with Slim and a skeleton whitch includes a secure authentication was really helpfull: I didn't find nothing good. So I decided to create and share this simple skeleton. Hope it will help you!

Table of Content
----------------

[](#table-of-content)

- [Getting Started](#getting-started)
- [Run Project](#run-project)
- [What is included](#what-is-included)
- [Authors](#autors)
- [Mind Mapping](#mind-mapping)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Licenses](#licenses)

Getting Started
---------------

[](#getting-started)

### Prerequisites

[](#prerequisites)

You have to install Composer before running the installation command. [Click here](https://getcomposer.org/) to see more information about Composer!

### Installing

[](#installing)

Navigate into your folder and issuing this command into a command line

```
`$ composer create-project --no-interaction samuelr/slim3-auth myapp-name`

```

### Run Project

[](#run-project)

1. `$ cd myapp-name`
2. `$ sudo php -S 0.0.0.0:8888 -t public public/index.php`
3. Browse to

If you have any problem make sure that you launched this command with **sudo**!

What is included
----------------

[](#what-is-included)

In this project you will find a Slim3-Based Project with:

1. Secure Session-Based authentication
2. Twig-View Template engine
3. MySQL Integration
4. Bootstrap 3 and FontAwesome already loaded
5. Integrated Monolog logger
6. Clean and easily editable code

Authors
-------

[](#authors)

- Samuel Roberto - Initial project

See also the list of [contributors](https://github.com/SamuelRoberto/slim3-authentication/graphs/contributors) who participated in this project.

Mind Mapping
------------

[](#mind-mapping)

You can find a full mind mapping for this project here:

- [Routes' mind-mapping](https://mind42.com/public/76fd491e-8c5b-4c57-b1d3-8c49f2ead066)
- [Structure's mind-mapping](https://mind42.com/public/6a1fac38-54f0-448b-a1ac-c1202683dcab)

Documentation
-------------

[](#documentation)

### Create and import database

[](#create-and-import-database)

To create database table open your MySQL (or MariaDB) console and launch the queries that you find in **'myapp-name/db/slim3\_auth\_example.sql'**. However these are the schemas:

```
    -- MySQL Script generated by MySQL Workbench
    -- ven 30 giu 2017 20:20:04 CEST
    -- Model: New Model    Version: 1.0
    -- MySQL Workbench Forward Engineering

    SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
    SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
    SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';

    -- -----------------------------------------------------
    -- Schema slim3_auth
    -- -----------------------------------------------------
    DROP SCHEMA IF EXISTS `slim3_auth` ;

    -- -----------------------------------------------------
    -- Schema slim3_auth
    -- -----------------------------------------------------
    CREATE SCHEMA IF NOT EXISTS `slim3_auth` DEFAULT CHARACTER SET utf8 ;
    USE `slim3_auth` ;

    -- -----------------------------------------------------
    -- Table `slim3_auth`.`user`
    -- -----------------------------------------------------
    DROP TABLE IF EXISTS `slim3_auth`.`user` ;

    CREATE TABLE IF NOT EXISTS `slim3_auth`.`user` (
      `id_user` INT NOT NULL AUTO_INCREMENT,
      `email` VARCHAR(120) NOT NULL,
      `password` VARCHAR(40) NOT NULL,
      `session` TEXT NOT NULL,
      `disabled` TINYINT(1) NOT NULL DEFAULT '0',
      `created_date` DATETIME NOT NULL DEFAULT NOW(),
      `modification_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
      PRIMARY KEY (`id_user`),
      UNIQUE INDEX `email_UNIQUE` (`email` ASC))
    ENGINE = InnoDB;

    SET SQL_MODE=@OLD_SQL_MODE;
    SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
    SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
```

### Database settings

[](#database-settings)

Now open the folder **'myapp-name/app/src/config.php'**. You will find the following code:

```
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_USER', 'root');
DEFINE('DB_PASS', '');
DEFINE('DB_NAME', 'slim3_auth');
```

Now you can set your Database's host, user, password and name.

Key directories
---------------

[](#key-directories)

- `app`: Application code
- `app/src`: All class files within the `App` namespace
- `app/templates`: Twig template files
- `cache/twig`: Twig's Autocreated cache files
- `db`: Database Files
- `log`: Log files
- `public`: Webserver root
- `vendor`: Composer dependencies

You can see a full structure [at the following link.](https://mind42.com/public/6a1fac38-54f0-448b-a1ac-c1202683dcab)

Contributing
------------

[](#contributing)

See the list of [contributors](https://github.com/SamuelRoberto/slim3-authentication/graphs/contributors) who participated in this project.

Licenses
--------

[](#licenses)

- `Slim3-Session-Base-Authentication`: Code released under MIT License
- `Slim3-Skeleton`: Added into LICENSE file

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/957fdfd418041892c59e650d9d609956b6e7e8be3e179e30d41945701c4e8050?d=identicon)[SamuelR](/maintainers/SamuelR)

---

Top Contributors

[![SamuelRoberto](https://avatars.githubusercontent.com/u/24282085?v=4)](https://github.com/SamuelRoberto "SamuelRoberto (9 commits)")

### Embed Badge

![Health badge](/badges/samuelr-slim3-authentication/health.svg)

```
[![Health](https://phpackages.com/badges/samuelr-slim3-authentication/health.svg)](https://phpackages.com/packages/samuelr-slim3-authentication)
```

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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