Coder Social home page Coder Social logo

spin-framework's Introduction

Latest Stable Version Total Downloads License PHP8 Ready

SPIN - A super lightweight PHP UI/REST framework

Latest Unstable Version Build Status

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>

spin-framework's People

Contributors

jackdupkevin avatar ksandell avatar pavan516 avatar tarunsavitr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

spin-framework's Issues

Implement hook system

Hooks are used to run classes before and after the requests, regardless of outcome of the request. These are similar to Middleware, but run earlier and later in the request lifecycle.

The hook system needs a Hook Manager that manages all hooks.
Hooks should be extended from Spin/Core/AbstractHook.

In addition to the code this needs documentation.

Add routes + controllers for error pages

A mechanism for choosing an error controller when something is wrong, like 404, 401 etc. pages. This allows to control what happens when no routes match the requests.

Currently when no route matches anything, a generic 404 is returned and no standard way to intercept this.

Implement a URL rewrite engine

URL rewrite engine should rewrite incoming request URL's. This should probably happen in a Middleware or even before that, as some Middleware are route group specific..

Proposal: ORM to test

I'm so sorry to disturb you, I would kindly ask you if you could test this library in your project!
https://github.com/javanile/moldable
With the purpose of knowing my project and understanding if it can be integrated into yours!
To thank you for your availability I am observing your project and giving a star

Install via composer

composer require javanile/moldable

I ask you if we can help each other

CacheFactory->createCache() should take 2 arguments

The CacheFactory->createCache() method should take 2 arguments:

$name = ''
$params = array()

$name indicates the "Cache driver" name and $params are the options defined in the config-{env}.json file. The $params are merged on the fly with the $this->options array that was provided in the constructor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.