PHPackages                             darkalchemy/slim-auth - 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. [Templating &amp; Views](/categories/templating)
4. /
5. darkalchemy/slim-auth

ActiveProject[Templating &amp; Views](/categories/templating)

darkalchemy/slim-auth
=====================

A Slim 4 skeleton with authentication

0.4.2(5mo ago)292243[8 PRs](https://github.com/darkalchemy/Slim-Auth/pulls)MITPHPPHP ^8.4CI passing

Since Feb 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/darkalchemy/Slim-Auth)[ Packagist](https://packagist.org/packages/darkalchemy/slim-auth)[ Docs](https://github.com/darkalchemy/slim-auth)[ RSS](/packages/darkalchemy-slim-auth/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (31)Versions (41)Used By (0)

Slim-Auth
=========

[](#slim-auth)

A Slim 4 Skeleton.

[![GitHub commits since tagged version](https://camo.githubusercontent.com/472b5bdc34f5d7c0edbee7ac7c5413396d0a30f3bcc21eed4ad95c851668f23a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f6461726b616c6368656d792f536c696d2d417574682f302e342e31)](https://camo.githubusercontent.com/472b5bdc34f5d7c0edbee7ac7c5413396d0a30f3bcc21eed4ad95c851668f23a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f6461726b616c6368656d792f536c696d2d417574682f302e342e31)[![Codacy Badge](https://camo.githubusercontent.com/51378547f167e9738eefd364ff187b1a96379e56f3aef36d262143f0ccfffa45/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3765303930383262656162343466373561666532656566646263353565633530)](https://www.codacy.com/gh/darkalchemy/Slim-Auth/dashboard?utm_source=github.com&utm_medium=referral&utm_content=darkalchemy/Slim-Auth&utm_campaign=Badge_Grade)[![GitHub Issues](https://camo.githubusercontent.com/8d0ce219fc3c8961e75d0717bd385867a85566398362278bec46b1ab69f250da/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6461726b616c6368656d792f536c696d2d41757468)](https://github.com/darkalchemy/Slim-Auth/issues)[![GitHub license](https://camo.githubusercontent.com/c4f7f5290d4ccba10b8c34b6b790c04ef6509812588957a448ce5a498465d708/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6461726b616c6368656d792f536c696d2d417574682e737667)](https://github.com/darkalchemy/Slim-Auth/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/e9981e33ba094e2a7039369bf453230c042c4c0437e80d8660b16ef92ec9f847/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6461726b616c6368656d792f536c696d2d417574682e737667)](https://packagist.org/packages/darlachemy/slim-auth)

This is a simple skeleton to quickly ramp up a slim 4 project.

PHP 8 is required
Composer is required
npm/npx is required

[Slim 4](https://github.com/slimphp/Slim) as the core framework
[nyholm/psr7](https://github.com/Nyholm/psr7) for the PSR-7 implementation
[php-di/php-di](http://php-di.org/) to manage dependency injection
[Cartalyst/Sentinel](https://cartalyst.com/manual/sentinel/3.) for user authentication and authorization
[delight-im/PHP-I18N](https://github.com/delight-im/PHP-I18N) for handling the users locale
[hellogerard/jobby](https://github.com/jobbyphp/jobby) to run all background jobs through cron
[Eloquent/ORM](https://github.com/illuminate/database) for database storage
[EmailValidator](https://github.com/egulias/EmailValidator/tree/master) for validating email addresses
[Middlewares/Trailing-slash](https://github.com/middlewares/trailing-slash) to remove any trailing slashes in the url
[Monolog](https://github.com/Seldaek/monolog) for logging
[PHPMailer](https://github.com/PHPMailer/PHPMailer) for sending email
[Phinx](https://phinx.org/) for database migrations
[Odan/Session](https://github.com/odan/session) for managing the session
[Slim/CSRF](https://github.com/slimphp/Slim-Csrf) to protect against csrf
[Slim/Flash](https://github.com/slimphp/Slim-Flash) for flash messaging
[Slim/Twig/Flash](https://github.com/kanellov/slim-twig-flash) (updated and included manually) for displaying flash messages in twig
[Slim/Twig-View](https://github.com/slimphp/Twig-View) for templates
[Slim/Whoops](https://github.com/zeuxisoo/php-slim-whoops) for displaying errors
[Twig-Translate](https://github.com/darkalchemy/Twig-Translate) for translations
[umpirsky/composer-permissions-handler](https://github.com/umpirsky/PermissionsHandler) to set folder permissions for log and cache folders
[Vlucas/Valitron](https://github.com/vlucas/valitron) for validation

To install using composer

```
composer create-project darkalchemy/slim-auth

```

cd into project, edit config/settings.php as needed and create the database.

```
cd slim-auth
nano config/settings.php

```

After install

```
composer migrate   # import database

```

To update for development

```
composer install           # install non-dev dependencies
npm install                # install dependencies
npm run build-dev          # create initial js/css resources
composer compile           # compile twig templates
composer migrate           # import database

```

To update for production

```
composer install --no-dev  # install non-dev dependencies
npm install                # install dependencies
npm run build              # create initial js/css resources
composer compile           # compile twig templates
composer migrate           # import database

```

Set up cron job, this is necessary to be able to run scripts as www-data when needed

```
sudo crontab -e

## add this to root crontab
* * * * * cd /path/to/bin folder/ && /usr/bin/php jobby.php 1>> /dev/null 2>&1

```

Emails do not get sent directly, they are inserted into the database and jobby will take care of sending them.

Compile twig templates for translating

```
composer compile

```

Translate all php files to locale - en\_US

```
composer translate en_US

```

Add additional locales

```
## check if locale is installed
locale -a

## find correct local
nano /usr/share/i18n/SUPPORTED

## in order to test the locale switcher, I needed to have another locale translated. I translated
## this using Google Translate, so the translation quality may not be very good. Please consider a
## pull request to improve the quality of the translation.
## add locale if not already installed (fr_FR)
sudo locale-gen fr_FR
sudo locale-gen fr_FR.UTF-8
sudo update-locale

## restart webserver (apache2|nginx)
sudo service nginx restart

## edit bootstrap/container.php and add the correct locale to the 'I18n::class' section
nano bootstrap/container.php

```

Translate all php files to locale - fr\_FR

```
composer translate fr_FR

```

Then open locale/\*\*/LC\_MESSAGES/messages.po in poedit and edit translation.

Then to create the binary forms of the translations, you need to run again for each locale

```
composer translate en_EN
composer translate fr_FR

```

Notes
-----

[](#notes)

If you want to use redis as your session handler, you should add this to php.ini and uncomment as needed, TCP or Socket

```
; TCP
; session.save_handler = redis
; session.save_path    = "tcp://127.0.0.1:6379?prefix=SlimAuth:&database=1"

; UNIX Socket
; session.save_handler = redis
; session.save_path = "unix:///dev/shm/redis.sock?prefix=SlimAuth:&database=1"

```

and add this to your redis.ini file

```
redis.session.locking_enabled=1

```

Add these to your apcu.ini

```
apc.enable_cli=1
apc.slam_defense=1

```

Available command line commands
-------------------------------

[](#available-command-line-commands)

```
composer cleanup          # runs php_cs_fixer
composer clear_cache      # clears all file based caches
composer compile          # compile all twig templates
composer create-migration # create new migration class
composer migrate          # migrate the database
composer rollback         # rollback all database changes
composer set-perms        # set writable perms for cache/log folders for both webserver and cli
composer translate [lang] # translate all strings for listed language
composer translate-all    # translate all strings for all currently available languages
npm build                 # create minified js/css resources
npm build-dev             # create js/css resources

```

TODO
----

[](#todo)

phpunit for testing.

Credits
-------

[](#credits)

Much of what I have done here I learned from watching videos on youtube, [Laracasts](https://laracasts.com/), [Codecourse](https://codecourse.com) and from what I have read in many of the online tutorials and Slim Skeletons on github.
[Slim4-Skeleton](https://github.com/odan/slim4-skeleton), [Slim-Skeleton](https://github.com/slimphp/Slim-Skeleton) and [Slim4-Starter](https://github.com/akrabat/slim4-starter) to list just a few.

I still have a long way to go, but I'm enjoying the trip. This should not be used for any production websites as there are still many things to correct.

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance83

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 96.5% 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 ~74 days

Recently: every ~362 days

Total

30

Last Release

172d ago

PHP version history (4 changes)0.1.2PHP &gt;=7.4.0

0.3.22PHP ^7.4

0.4.0PHP ^8.0

0.4.2PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3fc89ae39750b46a9745b2a2e33cd2ac8dad6803371722f2e183d8bdf5c53ca7?d=identicon)[darkalchemy](/maintainers/darkalchemy)

---

Top Contributors

[![darkalchemy](https://avatars.githubusercontent.com/u/30264374?v=4)](https://github.com/darkalchemy "darkalchemy (222 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![codacy-badger](https://avatars.githubusercontent.com/u/23704769?v=4)](https://github.com/codacy-badger "codacy-badger (1 commits)")[![pankajXdev](https://avatars.githubusercontent.com/u/44850923?v=4)](https://github.com/pankajXdev "pankajXdev (1 commits)")

---

Tags

csrfi18nilluminate-databasejobbyphinx-migrationsphpphp-diphpmailerpsr-7sentinelslimslim-flashslim-skeletonsslim4twigvalitronwebpackslimSkeletonslim4slim-framework

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/darkalchemy-slim-auth/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M517](/packages/shopware-core)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9317.2k55](/packages/open-dxp-opendxp)

PHPackages © 2026

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