Download the PHP package simplemvc/skeleton without Composer

On this page you can find all versions of the php package simplemvc/skeleton. 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 skeleton

Skeleton application for SimpleMVC

Build status

This is a skeleton web application for SimpleMVC framework.

Quickstart

You can install the skeleton application using the following command:

This will create a skeleton folder containing a basic web application. You can execute the application using the PHP internal web server, as follows:

The application will be executed at http://localhost:8080.

This skeleton uses PHP-DI as DI container and Plates as template engine.

Configuration

The application is configured using the (config/config.php) file:

Each section contains the configuration of the routing system (routing), database (database), etc.

Routing system

The routing system uses a Route class as follows (config/Route.php):

THis class contains onlya static method that returns the list of routes as array. A route is an element of the array with an HTTP method, a URL and a controller class to be executed. The URL can be specified using the FastRoute syntax. The controller class can be specified also with a pipeline of controllers, as array.

For instance, the GET /admin/users[/{id}] route has a pipeline with [Controller\AuthSession, Admin\Users\Read]. The controllers in the pipeline are executed in order, that means first Controller\AuthSession and last Admin\Users\Read.

Routing cache

The configuration of the skeleton application enables a caching folder for the routes.

Every time you change a route, you need to clean the cache using the following command:

If you want to disable the cache you can just comment (or delete) the key from the configuration array, as follows:

Controller

Each controller in SimpleMvc implements the ControllerInterface, as follows:

The execute() function accepts two parameters, the $request and the optional $response. These are PSR-7 HTTP request and response objects. The response is typically used when you need to execute a pipeline of multiple controllers, where you may want to pass the response from one controller to another.

The return of the execute() function is a PSR-7 Response. For instance, the Home controller reported in the skeleton application is as follows:

The execute() function returns a PSR-7 Nyholm\Psr7\Response object using the nyholm/psr7 project.

Execute a controller pipeline

In the route configuration file you can specify an array of controller to be executed. For instance, you can speficy that the Secret controller needs HTTP authentication and you can implement the logic in a separate Auth controller. The config/route.php configuration contains an example:

The third element of the array is an array itself, containing the list of controller to be executed. The order of execution is the same of the array, that means BasicAuth will be executed first and Secret after.

If you want, you can halt the execution flow of SimpleMVC returning a HaltResponse object. This response is just an empty class that extends a PSR-7 request to inform SimpleMVC to stop the execution.

SimpleMVC provideds a Basic Access Authentication using the BasicAuth controller.

Dependecy injection container

All the dependencies are managed using the PHP-DI project.

The dependency injection container is configured in config/container.php file.

Front controller

A SimpleMVC application is executed using the public/index.php file. All the HTTP requests pass from this file, that is called Front controller.

The front controller is as follows:

In this file we build the DI container, reading from the config/container.php file and we inject it to the [SimpleMVC\App]() class.

The application configuration is stored in the DI container with the config key.

We execute the bootstrap function. This is a special function used to initialize the application status, e.g starting the PHP session.

After, we build the PSR-7 HTTP request using App::buildRequestFromGlobals() from the PHP global variables $_GET, $_POST, $_SERVER, etc.

Then, we execute the dispatch function that executes the Controller(s) according to the route.

Finally, we render the PSR-7 response to the standard output using the SapiEmitter.

Copyright

The author of this software is Enrico Zimuel and other contributors.

This software is released under the MIT license.


All versions of skeleton with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
php-di/php-di Version ^6.0
league/plates Version ^3.4
simplemvc/framework Version ^0.3
monolog/monolog Version ^2.8
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 simplemvc/skeleton contains the following files

Loading the files please wait ....