celarius / spin-framework
A super lightweight PHP UI/REST Framework
Installs: 15 570
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 7
Open Issues: 3
Type:framework
Requires
- php: ^8
- ext-mbstring: *
- ext-openssl: *
- firebase/php-jwt: ^6
- guzzlehttp/guzzle: ^7.4
- league/container: ^5
- monolog/monolog: ^3
- nikic/fast-route: ^1
- predis/predis: ^2
- psr/cache: ^3
- psr/container: *
- psr/http-factory: ^1
- psr/http-message: ^2
- psr/log: *
- psr/simple-cache: ^3
- ramsey/uuid: ^4
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.0 || ^12.0
Suggests
- ext-apcu: In-memory caching capabilities
- dev-develop
- 0.0.34
- dev-cursor-autofixes
- dev-ksandell-patch-1
- dev-master
- dev-fix-composer-version-typo2
- dev-master-develop
- dev-fix-composer-version-typo
- dev-release-0.0.34
- dev-helpers-unit-tests
- dev-app-unit-tests
- dev-mysql-pdo-unit-tests
- dev-redis-unit-tests
- dev-more-unit-tests
- dev-release-0.0.33
- dev-fix-shared-container-league
- dev-release-0.0.32
- dev-hotfix-init-errors-controller
- dev-release-0.0.31
- dev-fix-php84-deprecations
- dev-pdo-8.4-fix
This package is auto-updated.
Last update: 2025-08-23 08:39:21 UTC
README
SPIN - A super lightweight PHP UI/REST framework
SPIN is a application framework for making Web UI's and REST API's quickly and effectively with PHP. It uses PSR standards for most things, and allows for plugging in almost any PSR compatible component, such as loggers, HTTP libraries etc.
1. Features
- PHP 8+
- Platform agnostic. (Windows, *nix)
- Routing engine, with route groups
- Middleware
- Containers
- Composer driven in packages/extensions
- PDO based DB connections (MySql,PostgreSql,Oracle,CockroachDb,Firebird,Sqlite ...)
- Extendable with other frameworks (ORM, Templates etc.)
1.1. PSR based integrations
- Logger (PSR-3) Defaults to Monolog
- HTTP Message (PSR-7). Defaults to Guzzle
- Container (PSR-11). Defaults to The Leauge Container
- SimpleCache (PSR-16). Defaults to APCu SimpleCache
- HTTP Factories (PSR-17)
2. Installation
Installing spin-framework as standalone with composer:
composer require celarius/spin-framework
2.1. Using the spin-skeleton
To install and use the spin-framework it is highly recommended to start by cloning the spin-skeleton and
running composer update -o
in the folder. This will download all needed packages, and create a template skeleton project, containing example
configs, routes, controllers and many other things.
2.2. Testing
On Windows based systems simply type
.\phpunit.cmd
At the command prompt and all tests will be executed.
3. Technical Details
3.1. Apache configuration
VHost for running the application under Apache with domain-name recognition.
If Port number based applications are desired the <VirtualHost:80>
needs to change to
the corresponding port, and the domain.name
removed from the config.
<VirtualHost *:80> Define domain.name mydomain.com Define alias.domain.name www.mydomain.com Define path_to_root C:/Path/Project Define environment DEV ServerName ${domain.name} ServerAlias ${alias.domain.name} ServerAdmin webmaster@${domain.name} DocumentRoot "${path_to_root}\src\public" ErrorLog "logs/${domain.name}.error.log" CustomLog "logs/${domain.name}.access.log" common # Default caching headers for static content in /public <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "public, max-age=604800, must-revalidate" </FilesMatch> <Directory "${path_to_root}\src\public"> Options -Indexes +FollowSymLinks AllowOverride All Order allow,deny Allow from all Require all granted # Set Variables SetEnv ENVIRONMENT ${environment} # Load files in this order on "/" DirectoryIndex bootstrap.php index.php index.html # Disable appending a "/" and 301 redirection when a directory # matches the requested URL DirectorySlash Off # Set Rewrite Engine ON to direct all requests to # the `bootstrap.php` file RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ bootstrap.php [QSA,L] </Directory> </VirtualHost>
3.2. Nginx configuration
server { listen 80; server_name mydomain.com www.mydomain.com; root C:/Path/Project/src/public; # Nginx on Windows still uses forward slashes index bootstrap.php index.php index.html; access_log logs/mydomain.com.access.log; error_log logs/mydomain.com.error.log; # Set environment variable for PHP-FPM fastcgi_param ENVIRONMENT DEV; # Default caching headers for static content location ~* \.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$ { add_header Cache-Control "public, max-age=604800, must-revalidate"; try_files $uri =404; } # Deny directory listings location / { try_files $uri $uri/ /bootstrap.php?$query_string; } # PHP handling (adjust the socket/path to your PHP-FPM setup) location ~ \.php$ { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; # or unix:/var/run/php/php8.1-fpm.sock fastcgi_index bootstrap.php; } }