Download the PHP package dupot/static-management-framework without Composer

On this page you can find all versions of the php package dupot/static-management-framework. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package static-management-framework

# Dupot Static Management Framework **A tiny, dependency-free PHP micro-framework for adding a dynamic back-office to your static websites.** [![Packagist](https://img.shields.io/packagist/v/dupot/static-management-framework.svg)](https://packagist.org/packages/dupot/static-management-framework) [![License: LGPL v3](https://img.shields.io/badge/License-LGPL_v3-blue.svg)](LICENSE) ![PHP](https://img.shields.io/badge/PHP-%3E%3D7.2-777BB4?logo=php&logoColor=white) ![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)

Why?

Static websites are fast, secure and cheap to host. But at some point you need a few dynamic pages to manage them: a login form, an editor for your news, a button that regenerates the site…

Pulling in a full-stack framework for that is overkill. Dupot Static Management Framework gives you exactly what you need, and nothing more:

Table of contents

Installation

Requirements: PHP β‰₯ 7.2. No other dependencies.

Quick start

Here is the target project structure:

1. Autoload your own code

Add your namespace to your project's composer.json, then run composer dump-autoload:

2. Create the front controller

File: public/index.php

3. Declare your routes

File: src/conf/routing.json

4. Run it

Open http://localhost:8000 and you're done πŸŽ‰

Routing

Each route is a JSON object with three fields:

Field Description
pattern A PCRE regular expression, with delimiters, tested on the URL path.
class The fully qualified class name of the page to instantiate.
method The method to call on that page.

Routes are tested in order and the first match wins. If no route matches, the application answers 404.

Captured groups are passed as method arguments. That makes routes with parameters easy:

πŸ’‘ Anchor your patterns with ^ and $. A pattern like #/# matches every URL.

Pages

A page is a class that extends PageAbstract. Before your method is called, the framework injects the Request, the Response and the ConfigManager, then calls the before() hook. Override before() for shared logic such as an authentication check.

File: src/Infrastructure/Pages/HomePage.php

File: src/Infrastructure/Pages/AboutPage.php

Example: protecting your pages

Layouts and views

Layouts and views are plain PHP files. The variables you pass are available in $this->contextList.

File: src/Infrastructure/Pages/Layout/default.php

File: src/Infrastructure/Pages/View/home.php

File: src/Infrastructure/Pages/View/about.php

Configuration

ConfigManager loads INI files (with sections) and lets you add values at runtime:

getSectionParam() throws an exception if the parameter doesn't exist, so a missing setting never goes unnoticed.

Request and response

Method Description
getPostParam($name) POST value. Throws if missing.
getPostParamOr($name, $default) POST value, or the default.
getPostParamList() / getGetParamList() All POST / GET values.
getSessionParam($name) / getSessionParamOr($name, $default) Session value.
setSessionParam($name, $value) Writes to the session (and $_SESSION).
isMethodGet() / isMethodPost() Tests the HTTP method.
getUrl() Path of the requested URL.
Response::redirect($url) HTTP redirection.

Architecture

Class Role
Application Dispatches the request to the right page
Setup\RouteManager Loads routes and matches URLs
Setup\ConfigManager Manages INI configuration
Http\Request Wraps GET / POST / SESSION / SERVER
Http\Response Redirections
Page\PageAbstract Base class for your pages
Render\Layout Page template
Render\View Content fragment

Contributing

Issues and pull requests are welcome on GitHub.

License

Released under the LGPL-3.0 license. Created by Michael Bertocchi.


All versions of static-management-framework with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dupot/static-management-framework contains the following files

Loading the files please wait ...