Download the PHP package conperience/lucille without Composer
On this page you can find all versions of the php package conperience/lucille. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download conperience/lucille
More information about conperience/lucille
Files in conperience/lucille
Package lucille
Short Description Lightweight HTTP abstraction
License BSD-3-Clause
Informations about the package lucille
Lucille HTTP Abstraction
Lucille is a lightweight HTTP abstraction layer based on the principles of CQRS. It is designed to quickly create restful services and web services/websites that require dynamic request handling.
Requirements
Minimum requirements:
- PHP 7.2+
- ext/dom (when using the XML/XHTML component)
- ext/xsl (when using the XSL component)
Basic Concepts
Request processing workflow
The Lucille HTTP Abstraction Framework follows in general the principles of CQRS. The regular processing of a request is done in six steps:
- The Request, separated by its HTTP request method (GET, POST, ...) is routed through an explicit RoutingChain to ensure separation from other request types
- Each router in the chain must decide to either be responsible to handle the request or have to decline it by forwarding it to the next router in the chain
- The matching router in the chain (the router that decides to be responsible to handle the current request) always returns a valid Command or Query object
- The Query or Command is executed
- The result of the execution is always a Result object
- The Result object is finally routed through a ResultRouterChain, which composes the final Response object which is sent to the client
The processing in short, for example for a GetRequest:
- GetRequest
- GetRoutingChain returns Query
- Query is executed and returns a QueryResult object
- The result routing chain is invoked and builds the final Response object
Supported HTTP Request Types
Currently the following http request methods are supported
- GET
- POST
- PUT
- PATCH
- DELETE
Usage
Full Example using the internal RequestProcessor
The easiest way is to use the provided RequestProcessor. When creating HTTP services you probably want to implement your own request processing mechanism to properly implement your own Logging and Exception handling.
Implementing Routers, Commands and Queries
Example Router (GET Request)
Example Query
URI Matching and Usage Examples
Request Parameter Examples
URI parameter by name
example request uri: /article?id=123
Working with Parameter Collections
Components and Helper
Lucille comes with some handy ready-to-use components to solve some daily problems. Most of these components are simply a lightweight wrapper for standard functionality. So when building complex websites or API projects these components may not fit your extended needs and should be implemented based on your current project scope.
- XML and XHTML Content
Contributing
Lucille and its Components are open source projects released under the BSD license. You are welcome to join the development team!