Simple Website Engine

Simple Yet Powerful Website Generator

Simple Website Engine Documentation

Welcome to the Simple Website Engine (SWSE) documentation. This documentation provides an overview of the core concepts, features, and usage of SWSE.

SWSE is a lightweight PHP framework designed to simplify the process of building dynamic websites and web applications.

This is not a full-blown framework to build a massive application, use it for small to medium projects or prototypes.

Getting Started

1. Creating the project structure

Create the following structure on your project folder for example /var/www/project-root

/var/www/project-root
│- /actions          # PHP action handlers
│- /views            # HTML templates and views
│- /public           # Publicly accessible files (index.php, assets, etc.)

2. Get the SWSE from GitHub

Then get the SWSE repository from GitHub

Place the repository into the /var/www/project-root/swse directory. The new structure would look like this:

/var/www/project-root
│- /actions          # PHP action handlers
│- /views            # HTML templates and views
│- /public           # Publicly accessible files (index.php, assets, etc.)
│- /swse             # SWSE core engine files

3. Add Public files into the public directory

.htaccess file

Add the following file into /var/www/project-root/public/.htaccess

RewriteEngine On

# Don't rewrite files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Route everything through index.php
RewriteRule ^(.*)$ index.php [QSA,L]

This would redirect any request through index.php in the public directory. See an example how to use url rewrites here.

index.php file

Add the following file into /var/www/project-root/public/index.php

<?php
include_once(__DIR__ . '/../swse/engine.php');
process(dirname(__DIR__));

This file initializes the SWSE engine and processes incoming requests. Adjust the path to the engine in case the structure is different.

Additional Configuration

Optinally make the project-root a GIT repository. If you do so, create a .gitignore file to exclude at least swse

# .gitignore file
swse

Next steps:

FAQ:

Why this is not a PHP Composer package

The SWSE is within only one file and it's not intended to build complex projects. If you want something robust - use Laravel, Symfony, or other full-featured frameworks. The SWSE is meant to be simple and easy to use without the need of Composer or other package managers.