Download the PHP package simovative/zeus without Composer

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

Simovative PRG-HTTP-Framework

Build Status Coveralls

Index

1.Design principles
2.Quickstart
3.General structure
4.Modifying components
5.Build

Design principles

This framework is made specifically for applications relying heavily on the HTTP protocol and the Post-Redirect-Get (PRG) design pattern. From our point of view it could be extended to create any kind of application, you just need to extend the HttpKernel or write your own Kernel. But currently this is not our intention.

To use the automatic form population, you need to use bootstrap (getbootstrap.com) as your frontend framework. If you do not want to use it, you need to write your own FormPopulation class and replace the existing with it. We will write a tutorial for it in future. See the mofifying components.

Why did we develop this framework

This framework was created in collaboration with Stefan Priebsch from the PHP Consulting Company (thePHP.cc). It aims to provide a solid solution to create a modular maintainable product out of our monolithic application. It should be easy to understand for young and inexperienced developers and delivers solid boundaries to develop new features in a maintainable way. A way of doing CQRS (Command Query Responsibility Segregation) is embedded into it, but if you do not need or want to use it, you can just ignore it (but we would not recommend it).

What is PRG?

Post-Redirect-Get is a common web development design pattern. See https://en.wikipedia.org/wiki/Post/Redirect/Get

Why would i want to use this framework over others?

This framework doesn't aim to provide a solution for every problem your application can possibly encounter, instead it tries to provide an elegant way to implement a very specific task. Unlike other frameworks it doesn't try to be a foundation for everything, but rather a solid solution for your applications very specific PRG needs. We also implement the majority of all other HTTP-Methods, so it is also easy to use for a SPA as Backend or to implement a Web-Api.

It aims to be compatible with other frameworks for other tasks. The commands are re-usable and you should be able to inject any kind of action you already have into the framework using the command-interfaces.

Compatibility

PHP 7.1 and up for now. We will remove the support for the older PHP versions very soon, so if you aim to stay on 7.1 or older, you should not use this framework.

Quickstart

This section explains how you can get the framework up and running as fast as possible.
Note: Registering the framework into an existing application is out of scope of this guide, but shouldn't be a big problem, as we also did this.

Generating your application

Install with composer

And let the cli help you in setting up a default application

This will create a folder public with an index.php file and a folder "bundles" containing the ApplicationBundle and ApplicationKernel.

You might want to configure your webserver right away to test if this worked.

Webserver config

Apache

Point your web-root to the $cwd/public

Nginx

PHP internal webserver

Just run the webserver and use the public/index.php as router script:

If everything worked you should see a basic setup page, telling you to add another bundle.

Generating a Bundle

Next, register the bundle, which we named "Test" in your Applications Kernel (in this case bundles/Application/DemoKernel.php)

If everything worked the Router should take over and you'll see a page with the message:

Generating a Page to display content (GET)

This will create two files in you bundles/Test/Page folder:

To create a route for this page add something similar to your GetRequestRouter

Generating a Page with a form that will be submitted (GET)

This will create two files in you bundles/Test/Page folder:

The only difference is, if the form is submitted to an command, and the validator invalidates it, the error messages and form content will be automatically populated to the form. This happens in the CommandDispatcher if you want to have a look at it.

Generating a Command (POST)

This will create five files in you bundles/Test/Command folder:

To create a route for this command add something similar to your CommandRouter

General Structure

Configuration

How you implement environments is up to you. Doing so can be really simple, like writing a small ini file containing information.

A more sophisticated way would be fetching the configuration values from the environment.

However, if your environments grow very complex you'll need a more sophisticated solution. The framework can handle everything as long as the resulting configuration can be narrowed down to a key-value array.

MasterFactory

All components of the framework are accessible through this factory

Other factories can register in this factory using the Factory Interface.

Conventions: All components of the framework usually call the factorymethods
with a "get" prefix for singletons and a "create" prefix if they explicitly require a new instance of a class. Thus, when injecting another factory into the master factory, methods not beginning with either "get" or "create" will be ignored.

Request

The framework has its own request classes that will be used to access the request values.

HTTPKernel

As mentioned previously, the framework does not ship a complete kernel, instead you have to extend the abstract HttpKernel or implement your own using the KernelInterface. The default HttpKernel will:

Example Implementation:

In most cases everything you need is to provide the bundles to be loaded and an ApplicationState (to handle sessions and such).

Bundle

Bundles are a collection of commands, factories, routers, controllers and models. When your application grows bigger, you might want to split up the code in different bundles, handling different parts. You should create at least one bundle to be able to register routers and factories. Although, you are not forced to, we highly encourage you to create one "ApplicationBundle", that handles the very basic things of your application, like its core elements, dependencies to other software packages, connections to persistent storage systems, the ApplicationState and so on. Everything else should be put in other bundles. For example a "UserBundle" to handle everything related to user login, registration, password changes, displaying profile pages and stuff like that. You should keep your bundles as independent as possible from any other bundles, otherwise you will create a dependency hell.

The registration of bundles happens in the kernel

For bundles to work properly with the HttpKernel shipped by the framework, they have to implement the BundleInterface.

BundleFactory

A bundle is able to provide one or more factories that are being registered into the MasterFactory.

Todo: Example/Code

Commands

Whatever your application wants to do, it'll happen inside commands. For the commands to be reusable by other frameworks and other entry-points of your application (like APIs or CLI for cronjobs and so on) the requests are separated in CommandRequest, Command, CommandValidation and CommandHandler. All Commands are supposed to be handled inside a Bundle.

Commands will be executed in Post-Requests only

Request

Extend the abstract class CommandRequest. You have to implement two Methods:

Todo: Example/Code

Command

The Command itself is basically just a container to store all information needed in handling a specific task.

Validation

Takes the PostRequest and validates the parameters used by the command.

The framework does not enforce validation.

That means if you're too lazy to validate properly your application might end up easily exploitable.

Handler

The CommandHandler makes a Command executable with everything Transport- Protocol related already abstracted. It consists of a single execute Method taking the Command and returning a CommandResponse.

Routing

The framework does handle POST, GET and all other type of HTTP-requests separately. There are different RouterChains for all types in which routers can be registered. Bundles will register only the appropriate chain depending on the request type.

Todo: Example

Controller

Controllers are used for Command-Requests only. The CommandDispatcher will use Controllers provided by the bundle to determine which Content to display after the command execution. It is important for the framework to know what to do in case a command doesn't execute or the validation fails.

CommandResponses

A command response signals the application/bundle controller the result of a command handler and lets the application react accordingly. Two default responses are already implemented that should fit most cases (CommandSuccessResponse, CommandFailureResponse), but you can implement any kind of response yourself.

Content

HttpResponses & Locator

This HttpResponseLocator class will translate a content into its http representation. Not all kind of possible content and responses are available in the framework. In case you need something that is not yet implemented, you can use your own HttpResponseLocator class and implement any content with any kind of http response for it. For very special cases you can bypass this and directly return a http response in the router or controller.

TemplateEngine

The default template engine that is used is smarty. You can replace it with any your want in your application factory.

ApplicationState

This is the equivalent of a session, but it can be anything that represents the current state of your application.

Implementing a login wall

A very common case for a application is having a login wall and all other functionality is hidden behind this. Zeus does provide a very simple way of doing this. We recommend implementing the login functionality and the login check in a separate bundle and registering this bundle directly after the application bundle in the "registerBundles" method of your kernel.

The LoginBundle will implement a login check in its routers and return the login page if the user is not logged in. In that way the routers of the other bundles will never get the request, because zeus does call the routers in the order in which the bundles are registered. In this way you can do any kind of pre processing.

Modifying Components

These examples should make you familiar with the process of modifying the behaviour of the framework with your application. Note: It should not be necessary to modify the sources of the framework in any way.

Create your own FormPopulation

Scenario: We do not want to use bootstrap as frontend framework but we love the automatic form population

TODO

Example: Implementing Pre- and PostFilterChains

Scenario: We have a huge application with hundreds of routes and didn't care about localisation. Now the team decided to implement locales by adding en/ fr/ de/ es/ and so on at the beginning of the URI. TODO

Example: Changing the Router

TODO

Example: Changing the Template Engine

TODO

Example: Enforce generic ACL

TODO

Extending your Application

TODO

Add Language/Translation Support

TODO

Add database support with doctrine

TODO

Add a consul key/value store

TODO

Build

Windows:

Linux:

Run tests


All versions of zeus with dependencies

PHP Build Version
Package Version
Requires ext-intl Version *
ext-json Version *
guzzlehttp/guzzle Version >=6.0.0, <8.0.0
php Version ^8.2 || ^8.3
psr/http-message Version ^1.0 || ^2.0
psr/http-server-handler Version ^1.0
smarty/smarty Version >=3.1.48 <5.0.0
symfony/debug Version <5.0.0
symfony/console Version >=4.0.0
roave/security-advisories Version dev-latest
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 simovative/zeus contains the following files

Loading the files please wait ....