All Projects → darkalchemy → Slim-Auth

darkalchemy / Slim-Auth

Licence: MIT license
A Slim 4 Skeleton.

Programming Languages

PHP
23972 projects - #3 most used programming language
Twig
543 projects
javascript
184084 projects - #8 most used programming language
SCSS
7915 projects

Projects that are alternatives of or similar to Slim-Auth

framework
A stylish PHP application framework crafted using Slim, Twig, Eloquent and Sentinel designed to get you from clone to production in a matter of minutes.
Stars: ✭ 56 (+154.55%)
Mutual labels:  twig, slim, sentinel, csrf
slim-tutorial
Php Slim Framework Tutorial
Stars: ✭ 26 (+18.18%)
Mutual labels:  slim, slim4
twig-translation
A Twig Translation Extension
Stars: ✭ 15 (-31.82%)
Mutual labels:  twig, slim4
REST-Api-with-Slim-PHP
REST API with PHP Slim Framework 3 and MySQL
Stars: ✭ 69 (+213.64%)
Mutual labels:  slim, phpmailer
Nofw
A no-framework application skeleton
Stars: ✭ 212 (+863.64%)
Mutual labels:  i18n, twig
Slim3
Slim Framework 3 Skeleton Application
Stars: ✭ 70 (+218.18%)
Mutual labels:  twig, slim
slim-php-di
Slim Framework PHP-DI container integration
Stars: ✭ 13 (-40.91%)
Mutual labels:  slim, php-di
lagan
Lagan is a different take on a CMS, with a focus on flexibility. Built with Slim, Redbean and Twig.
Stars: ✭ 44 (+100%)
Mutual labels:  twig, slim
next.js-boilerplate
next.js bolierplate, next.js 的开发模板
Stars: ✭ 28 (+27.27%)
Mutual labels:  i18n, csrf
basepath
Base path detector for Slim 4
Stars: ✭ 36 (+63.64%)
Mutual labels:  slim, slim4
msgtools
Tools for Developing Diagnostic Messages
Stars: ✭ 18 (-18.18%)
Mutual labels:  i18n
GraphQLSuiteCRM
GraphQL SuiteCRM - Integrate with SuiteCRM using GraphQL
Stars: ✭ 18 (-18.18%)
Mutual labels:  slim
DenseNet-Tensorflow
Reimplementation of DenseNet
Stars: ✭ 16 (-27.27%)
Mutual labels:  slim
drupal-template-helper
Debug Drupal 8 templates in Chrome Devtools. drupal-template-helper is a chrome extension for Drupal that lists all available templates and the preprocess hooks to use to customize your templates.
Stars: ✭ 115 (+422.73%)
Mutual labels:  twig
strf
Yet another C++ text formatting library.
Stars: ✭ 57 (+159.09%)
Mutual labels:  i18n
asgi-csrf
ASGI middleware for protecting against CSRF attacks
Stars: ✭ 43 (+95.45%)
Mutual labels:  csrf
JavaFamily
【Java面试+Java学习指南】 一份涵盖大部分Java程序员所需要掌握的核心知识。
Stars: ✭ 517 (+2250%)
Mutual labels:  sentinel
typesafe-i18n
A fully type-safe and lightweight internationalization library for all your TypeScript and JavaScript projects.
Stars: ✭ 1,227 (+5477.27%)
Mutual labels:  i18n
Foxy
🦊 A very, very cute, multipurpose, multilingual bot for Discord! Making your server cuter -w-
Stars: ✭ 58 (+163.64%)
Mutual labels:  i18n
emailqueue
A fast, simple yet very efficient email queuing system for PHP/MySQL
Stars: ✭ 75 (+240.91%)
Mutual labels:  phpmailer

Slim-Auth

A Slim 4 Skeleton.

GitHub commits since tagged version Codacy Badge GitHub Issues GitHub license Total Downloads

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 as the core framework
nyholm/psr7 for the PSR-7 implementation
php-di/php-di to manage dependency injection
Cartalyst/Sentinel for user authentication and authorization
delight-im/PHP-I18N for handling the users locale
hellogerard/jobby to run all background jobs through cron
Eloquent/ORM for database storage
EmailValidator for validating email addresses
Middlewares/Trailing-slash to remove any trailing slashes in the url
Monolog for logging
PHPMailer for sending email
Phinx for database migrations
Odan/Session for managing the session
Slim/CSRF to protect against csrf
Slim/Flash for flash messaging
Slim/Twig/Flash (updated and included manually) for displaying flash messages in twig
Slim/Twig-View for templates
Slim/Whoops for displaying errors
Twig-Translate for translations
umpirsky/composer-permissions-handler to set folder permissions for log and cache folders
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

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

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

phpunit for testing.

Credits

Much of what I have done here I learned from watching videos on youtube, Laracasts, Codecourse and from what I have read in many of the online tutorials and Slim Skeletons on github.
Slim4-Skeleton, Slim-Skeleton and 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].