2017 © Pedro Peláez
 

library stateless

Stateless Content Management System

image

stateless-cms/stateless

Stateless Content Management System

  • Monday, November 27, 2017
  • by drewimmerman
  • Repository
  • 0 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

StatelessCMS

Object-oriented PHP building-blocks for websites and webapps., (*1)

Introduction

StatelessCMS is a headless PHP framework designed for creating database-driven PHP applications, "headless" meaning there is no existing front-end. StatelessCMS isn't an app or a CMS itself - it just gives you the building blocks to create one yourself., (*2)

Installation

Minimum Requirements

Get a server running PHP 7.0 and a SQL database. Note that apache is recommended, as Request::getHeaders() and Request::getToken() rely on apache_get_headers() as of v0.0.3, (*3)

Composer Install

The easiest way to install StatelessCMS is to install with Composer:, (*4)

composer require stateless/cms

Web Download

Download the latest release from https://github.com/StatelessSoftware/StatelessCMS/releases., (*5)

Development

If you would like the live development branch instead, download or clone from github. https://github.com/StatelessSoftware/StatelessCMS.git, (*6)

Setting up your first project

Although you are free to use any directory structure you choose, the common basic structure for StatelessCMS is as follows. Don't worry too much about the specifics - we'll create each part step by step., (*7)

|- app
    |- Controller
    |- Form
    |- FormInput
    |- Layout
    |- Menu
    |- Model
    |- View
    |- app.php
    |- functions.php
|- conf
    |- app.conf.php
|- public
    |- css
    |- js
    |- .htaccess
    |- index.php
|- vendor
    |- stateless

If you didn't already, install StatelessCMS to vendor/stateless (follow installation instructions above), (*8)

Getting started

Open public/index.php. Insert the following code:, (*9)

<?php
namespace Stateless;

require_once("../vendor/autoload.php");

echo "Home";

If you downloaded and installed StatelessCMS without using Composer, change ../vendor/autoload.php to your StatelessCMS.php file, (*10)

About public/index.php

This file is the entry point, meaning it is the start of the program. For now, we will use it to show our examples. Later, we can use it to startup our application., (*11)

Test

Open a browser and navigate to localhost/public/ You should see Home., (*12)

Configuring your server

Ensure your httpd document root is set to public/ Now navigate to localhost/ and you should see Home, (*13)

Enable mod_rewrite (Clean URLs)

  1. In a directory block for public, set AllowOverride All
  2. Copy the following htaccess file to public/.htaccess

You may need to install mod_rewrite, (*14)

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
</IfModule>

Several pages

Now we will create additional pages with clean urls. Replace index.php with the following code, (*15)

<?php
namespace Stateless;
require_once("../vendor/autoload.php");

switch (Request::getPath()) {
    case "/":
        echo "Home";
    break;

    case "/about":
        echo "Read all about us!";
    break;

    case "/contact":
        echo "Contact us.";
    break;

    default:
        Response::header(404);
        echo "Page not found.";
    break;

}

Load up localhost/about in your browser, you should see "Read all about us!", (*16)

The Versions

27/11 2017

dev-master

9999999-dev

Stateless Content Management System

  Sources   Download

The Requires

  • php ^7.0

 

27/11 2017

0.2.0

0.2.0.0

Stateless Content Management System

  Sources   Download

The Requires

  • php ^7.0

 

19/11 2017

0.1.0

0.1.0.0

  Sources   Download

The Development Requires

07/11 2017

0.0.3

0.0.3.0

  Sources   Download

The Development Requires

05/11 2017

0.0.1

0.0.1.0

  Sources   Download

The Development Requires