Git Product home page Git Product logo

spin-framework's Introduction

Latest Stable Version Total Downloads License PHP7 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 7.1+
  • 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

ksandell avatar pavan516 avatar

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.