hxgf/slime

Starter kit for building web apps with Slim 4

Installs: 25

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 2

Language:HTML

Type:project

1.2.2 2024-03-22 21:43 UTC

This package is auto-updated.

Last update: 2024-04-22 23:31:42 UTC


README

Starter kit for building web applications with Slim PHP Framework

SLIME is a highly opinionated boilerplate for Slim applications. It's designed for solo developers working in "small scale" environments. While it produces a reliable final product, this configuration focuses on developer velocity, making it easy to provide value quickly without introducing unnecessary technical overhead.

What's included?

  • Slim v4 (w/ Slim PSR-7)

  • Handlebars templating - Lightncandy

  • View rendering helpers - Slime Render

  • Helpful Vanilla PHP abstraction libraries:

  • Minimal front-end boilerplate & utility library options - scratch

  • Simple organization - folders for css, js, images, templates, and controllers

  • Blank CSS and JS placeholder files

  • .env - helpful basic variables and settings, pre-wired with phpdotenv

  • index.php - initialized Slim application w/ middleware, db connection, and default 404 configuration

  • .htaccess - routes all non-file urls to index, forces https, and uses gzip for static assets (if available)

  • .gitignore - ignores /vendor, .env, .vscode, error_log, and .DS_Store

Requirements

  • Apache
  • PHP >= 7.4
  • PDO-compatible database (if using DB handlers)

Installation

Easy install with composer:

composer create-project jyoungblood/slime new-project-name

Initialize the .env file, using the boilerplate example:

mv .env.example .env

Usage

Although SLIME is currently not intended for local development workflows, you're welcome to try your luck with PHP's built-in server:

php -S localhost:6969

Alternatively, you could use Herd, which is an excellent tool for local development.

See controllers/index.php for an example of routing and template rendering.

See templates/index.html and templates/_layouts/base.html for examples using handlebars and layouts.

Helpful resources:

Check out slime-demo to see more examples of the kind of things you can do with SLIME!

Slime is heavily inspired by STEREO, an older toolkit I've assembled and maintained, which has helped me to be very productive and make a decent living over the years.

I hope these tools and the workflows they enable can help some of you as much as they've helped me : )