SkillAgentSearch skills...

Fastsitephp

🌟 FastSitePHP 🌟 A Modern Open Source Framework for building High Performance Websites and API’s with PHP

Install / Use

/learn @fastsitephp/Fastsitephp
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<p align="center"> <img width="500" src="docs/FastSitePHP.svg" alt="FastSitePHP"> </p>

🌟 Welcome to FastSitePHP!

Thanks for visiting! 🌠👍

<table> <tbody> <tr align="center"><td colspan="2"> <g-emoji class="g-emoji" alias="globe_with_meridians" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f310.png"><img class="emoji" alt="globe_with_meridians" height="20" width="20" src="https://github.githubassets.com/images/icons/emoji/unicode/1f310.png"></g-emoji> <g-emoji class="g-emoji" alias="earth_americas" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f30e.png"><img class="emoji" alt="earth_americas" height="20" width="20" src="https://github.githubassets.com/images/icons/emoji/unicode/1f30e.png"></g-emoji> <g-emoji class="g-emoji" alias="earth_asia" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f30f.png"><img class="emoji" alt="earth_asia" height="20" width="20" src="https://github.githubassets.com/images/icons/emoji/unicode/1f30f.png"></g-emoji> <g-emoji class="g-emoji" alias="earth_africa" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f30d.png"><img class="emoji" alt="earth_africa" height="20" width="20" src="https://github.githubassets.com/images/icons/emoji/unicode/1f30d.png"></g-emoji> </td></tr> <tr> <td><a href="https://github.com/fastsitephp/fastsitephp/blob/master/docs/i18n-readme/README.es.md">Español</a> </td> <td><a href="https://github.com/fastsitephp/fastsitephp/blob/master/docs/i18n-readme/README.es.md">Bienvenido a FastSitePHP</a></td> </tr> <tr> <td><a href="https://github.com/fastsitephp/fastsitephp/blob/master/docs/i18n-readme/README.pt-BR.md">Português (do Brasil)</a> </td> <td><a href="https://github.com/fastsitephp/fastsitephp/blob/master/docs/i18n-readme/README.pt-BR.md">Bem vindo ao FastSitePHP</a></td> </tr> </tbody> </table>

FastSitePHP is a modern open source Framework for building High Performance websites and API’s with PHP. FastSitePHP has been designed for fast performance, coding flexibility, long term stability, ease of use, and a better overall development experience. FastSitePHP is minimal in size so it quick to download and easy to get started. FastSitePHP was first published in November of 2019; and it was written and used over many years prior to its release. As of 2024 has been used in a variety of applications and websites and is extremely stable and contains many unit tests.

This repository contains FastSitePHP’s Framework and main Website.

FastSitePHP includes many Standalone Components that can be used without using the main Application object or Framework so it’s easy to use FastSitePHP with other PHP Frameworks or Projects.

💫 Why use FastSitePHP?

|<img src="https://github.com/fastsitephp/fastsitephp/blob/master/website/public/img/icons/Performance.svg" alt="Great Performance" width="60">|<img src="https://github.com/fastsitephp/fastsitephp/blob/master/website/public/img/icons/Lightswitch.svg" alt="Easy to setup and use" width="60">| |---|---| |Great Performance With FastSitePHP complex pages can be generated within thousands of a second using only a small amount of memory. This level of performance even allows for sites to run fast on low powered computers.|Easy to setup and use FastSitePHP is designed so that it easy to setup to on any OS, easy to read the code, easy to develop with, and much more. With FastSitePHP high quality websites and apps can be developed at a rapid pace using fewer lines of code and minimal config.|

|<img src="https://github.com/fastsitephp/fastsitephp/blob/master/website/public/img/icons/Samples.svg" alt="Quick to learn and debug" width="60">|<img src="https://github.com/fastsitephp/fastsitephp/blob/master/website/public/img/icons/Security-Lock.svg" alt="Strong Security" width="60">| |---|---| |Quick to learn and debug FastSitePHP is well documented and comes with practical samples. FastSitePHP provides developer friendly error messages so that errors can be fixed quickly even if you have little or no experience programming with PHP.|Strong Security Security has been carefully planned in all features of FastSitePHP so that it is both secure and easy to work with. Security features include Encryption (text, objects, and files), Signed Cookies, JWT, CORS, Proxy Server Validation, Rate Limiting, and more.|

🚀 Try it online!

The main site for FastSitePHP provides a Code Playground where you can develop with PHP, HTML, JavaScript, CSS, and more. There is nothing to install and you can work with PHP directly on a server. If you have never used PHP this is a great way to learn PHP.

https://www.fastsitephp.com/en/playground

<p align="center"> <img src="https://github.com/fastsitephp/static-files/raw/master/img/screenshots/Playground.png" alt="FastSitePHP Code Playground"> </p>

🚀 Getting Started

Getting started with PHP and FastSitePHP is extremely easy. If you do not have PHP installed then see instructions for Windows, Mac, and Linux on the getting started page:

<a href="https://www.fastsitephp.com/en/getting-started" target="_blank">https://www.fastsitephp.com/en/getting-started</a>

Once PHP is installed you can launch the site from the command-line as show below or if you use a Code Editor or IDE [Visual Studio Code, GitHub Atom, etc] then you can launch the site directly from your editor. See the above getting started page for more.

Download and run the Main Website and Full Framework (~1.2 mb)

# Download this Repository
cd {root-directory}
php -S localhost:3000

To include support for rendering server-side markdown documents or support for crypto functions with older versions of PHP (PHP 5) first run the install script.

cd {root-directory}
php ./scripts/install.php

Install using Composer (PHP Dependency/Package Manager) (~470 kb)

The FastSitePHP Framework can also be installed using Composer. When installed from Composer only the core Framework files are included and not this full Repository with the Main Website. The size of downloaded files is small, so it’s quick to include with existing PHP projects or use to start new projects. FastSitePHP classes can be used with existing Symfony, Laravel, Zend or other PHP Frameworks when using Composer.

composer require fastsitephp/fastsitephp

Start with a Starter Site (~67 kb)

A starter site for FastSitePHP also exists that includes several examples pages and provides a basic directory/file structure. It’s small in size and quick to setup.

https://github.com/fastsitephp/starter-site

<p align="center"> <img src="https://github.com/fastsitephp/static-files/raw/master/img/starter_site/2020-01-10/home-page.png" alt="FastSitePHP Starter Site"> </p>

📄 Example Code

<?php

// -------------------------------
// Setup
// -------------------------------

// Setup a PHP Autoloader
// This allows classes to be dynamically loaded
require '../../../autoload.php';

// OR for a minimal site only the following 2 files need to be included
// require '../vendor/fastsitephp/src/Application.php';
// require '../vendor/fastsitephp/src/Route.php';

// Create the Application Object with Error Handling and UTC for the Timezone
$app = new \FastSitePHP\Application();
$app->setup('UTC');

// -------------------------------
// Define Routes
// -------------------------------

// Send a response of 'Hello World!' for default requests
$app->get('/', function() {
    return 'Hello World!';
});

// Send a response 'Hello World!' for the URL '/hello' or in the case of the
// optional [name] variable safely escape and return a message with the name
// (example: '/hello/FastSitePHP' will output 'Hello FastSitePHP!')
$app->get('/hello/:name?', function($name = 'World') use ($app) {
    return 'Hello ' . $app->escape($name) . '!';
});

// Send a JSON Response that contains an object with basic Site info
$app->get('/site', function() use ($app) {
    return [
        'rootUrl' => $app->rootUrl(),
        'rootDir' => $app->rootDir(),
        'requestedPath' => $app->requestedPath(),
    ];
});

// Send a JSON Response that contains basic Request info
$app->get('/request', function() {
    $req = new \FastSitePHP\Web\Request();
    return [
        'acceptEncoding' => $req->acceptEncoding(),
        'acceptLanguage' => $req->acceptLanguage(),
        'origin' => $req->origin(),
        'userAgent' => $req->userAgent(),
        'referrer' => $req->referrer(),
        'clientIp' => $req->clientIp(),
        'protocol' => $req->protocol(),
        'host' => $req->host(),
        'port' => $req->port(),
    ];
});

// Send the contents of this file as a plain text response using
// HTTP Response Headers that allow for the end user to cache the  
// page until the file is modified
$app->get('/cached-file', function() {
    $file_path = __FILE__;
    $res = new \FastSitePHP\Web\Response();
    return $res->file($file_path, 'text', 'etag:md5', 'private');
});

// Return the user's IP Address as a JSON Web Service that supports
// Cross-Origin Resource Sharing (CORS) and specifically tells the browser
// to not cache the results. In this example the Web Server is assumed to
// be behind a proxy server (for example a Load Balancer) and the IP Address
// is safely read from it. Additionally the cors() function is called from a
// filter function which only gets called if the route is matched and allows
// for correct handling of an OPTIONS request.
$app->get('/whats-my-ip', function() {
    $req = new \FastSitePHP\Web\Request();
    return [
        'ipAddress' => $req->clientIp('from proxy', 'trust local'),
    ];
})
->filter(function() use ($app) {
    $app
        ->noCache()
        ->cors('*');
});

// Define a function that returns true if the web request is coming
// from a local network (for example 127.
View on GitHub
GitHub Stars130
CategoryData
Updated3d ago
Forks28

Languages

PHP

Security Score

100/100

Audited on Apr 4, 2026

No findings