celarius / spin-framework
A super lightweight PHP UI/REST Framework
Installs: 13 328
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 4
Forks: 6
Open Issues: 4
Type:framework
Requires
- php: ^8
- ext-mbstring: *
- ext-openssl: *
- firebase/php-jwt: ^6
- guzzlehttp/guzzle: ^7.4
- league/container: ^3
- monolog/monolog: ^3
- nikic/fast-route: ^1
- predis/predis: ^2
- psr/cache: ^3
- psr/container: ^2
- psr/http-factory: ^1
- psr/http-message: ^2
- psr/log: ^3
- psr/simple-cache: ^3
- ramsey/uuid: ^4
Suggests
- ext-apcu: In-memory caching capabilities
This package is auto-updated.
Last update: 2024-11-04 07:42:33 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.
NOTE: This framework is in RC stage - Please contribute to make it complete
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 ...)
- DAO base classes for DB Entity representation
- 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
Having PHPUnit installed simply type
phpunit
At the command prompt and all tests will be executed.
3. Technical Details
3.1. Apache VHost 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>