SlimPHP
When you don't need
the kitchen sink
Joe Ferguson
Who Am I?
Joe Ferguson
PHP Developer
PHP Architect @ Ministry Brands
Twitter: @JoePFerguson
Organizer of @MemphisPHP
OSMI Board Member
Certified Laravel Developer
Drone Racing Pilot
“everything but the kitchen sink”
Router
Dispatcher
Views (Twig/etc)
Database
ORM (Models)
Authentication
Scaffolding
API basics
Validation/Sanitization
CLI Components
Job/Task system
Mail Handling
Full Stack Frameworks are fine
Micro Frameworks are fine
Component Based Frameworks
Which way do you want to go?
ComponentFull Stack
How do I choose what to use?
How do I choose what to use?
It Depends™
Size
Scale
Existing knowledge
Long term Maintenance
How I choose what to use
Project needed quickly?
How I choose what to use
Project needed quickly?
Aren’t they all?
How I choose what to use
Project needed quickly?
Aren’t they all?
Am I going to maintain it?
Yes/No
How I choose what to use
Project needed quickly? No
Do I have time to learn a new
framework or component?
How I choose what to use
Project needed quickly? No
Do I have time to learn a new
framework or component?
Yes
How I choose what to use
Project needed quickly? No
Do I have time to learn a new
framework or component?
YesNo
How I choose what to use
Project needed quickly?
Aren’t they all?
No
Am I going to maintain it?
Yes/No
Do I have time to learn a new
framework or component?
YesNo
SlimPHP
Getting Started
New to SlimPHP?
composer create-project slim/slim-skeleton slimphp
Creating The Project
Running the Project
Running the Project
Mission Accomplished!
What is included?
Under the Hood
Settings
Dependencies
Middleware
Routing
Views
Tests
Tests
Container Ready
Container Ready
Virtual Machine Friendly
./vendor/bin/homestead make
Vagrant up
http://slim.test
Vagrant ssh
Building a Small Application
Add a Database Settings
Add a Database Dependency
Using Components From
Bigger Frameworks
Update Database Dependency
Update Composer.json
AppMigrationMigration.php
Our First Migration
Running our Migration
Viewing our Database
Viewing our Database
Creating a new widget
Creating a new widget
Viewing our Widget in the DB
Add Widgets Index Route
Add our Widgets Index View
Add our Widgets Index View
Viewing our Widgets
Adding a Widget
Adding a Widget
Adding a Widget
Post Route & Form Handling
composer require slim/csrf
Add CSRF to our Container
Update our Add Route
Update our Add View
Update our POST route
What about input filtering?
composer require zendframework/
zend-filter
Filtering our Input
composer require
zendframework/zend-escaper
Escape our Output
Safely storing and displaying data
Safely storing and displaying data
composer require guzzlehttp/guzzle
Sending a Guzzle Request
Parse Response Object
Add BTC prices for Widgets
Add BTC prices for Widgets
composer require symfony/console
Create our CLI Application
Configure Method
Execute Method
Create our Command
Running the Bitcoin Command
Update our Widgets GET Request
Questions?
Joe Ferguson
Twitter: @JoePFerguson
Email: joe@joeferguson.me
Freenode: joepferguson
Contact Info:
https://joind.in/talk/a89e0

Slim PHP when you don't need the kitchen sink