Download the PHP package crazy-goat/micro-app without Composer

On this page you can find all versions of the php package crazy-goat/micro-app. 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 micro-app

MicroApp PHP Framework

MicroApp is a minimalist PHP micro-backend framework built to run on top of the fast Workerman HTTP server. It enables you to quickly create lightweight micro-backends using Symfony commands and attribute-based routing.

Features

Getting Started

Dependencies

Installation

Install MicroApp via Composer:

Creating a Micro-Backend

  1. Create a Symfony Application using MicroApp:
  1. Run your application:

Example:

Configuration Options

Option Description Default
--port Port to listen on 8080
--listen Interface/address to bind 0.0.0.0
--workers Number of PHP worker processes 4
--reuse_port Use SO_REUSEPORT if available false
--dev Reload server every request. Use for development false
--max-reques Reload server N request. Use this if you have memory leaks. null
--reload-on-exception If exception appears in code, reload worker. false

Server commands

Routing

To register a route, you must use the #[Route] attribute. You can provide HTTP method(s) (e.g., GET, POST) and a path. These parameters are directly passed to the nikic/FastRoute's addRoute method, allowing you to define flexible and powerful routing rules.

Accessing the route parameters is as simple as accessing the $request->context['router']['arguments']['name'] array.

Event Dispatcher

MicroApp includes a simple Event Dispatcher that allows you to hook into various lifecycle events of the application. You can register listeners using the onEvent() method on your MicroApp instance.

Available Events

Event Name Parameters
onServerStart Worker $worker
onMessage TcpConnection $connection, Request $request
onResponse TcpConnection $connection, Request $request, Response $response
onWorkerStart Worker $worker
onConnect TcpConnection $connection
onClose TcpConnection $connection
onWorkerReload Worker $worker

Example

Middlewares

MicroApp supports middleware to process requests before they reach your controller and to modify responses before they are sent. Middlewares are classes that implement CrazyGoat\MicroApp\Middlewares\MiddlewareInterface. When registering middleware, you must provide an index. By default, the router middleware's index is 1000. Middlewares with an index lower than 1000 will execute before the router, allowing pre-processing of the request, while those with a higher index will execute after the router. Note that only one middleware can be registered per index.

Example Middleware

License

MIT

Credits


All versions of micro-app with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-pcntl Version *
ext-posix Version *
symfony/console Version ^7.0
nikic/fast-route Version ^1.3
workerman/workerman Version ^5.1
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 crazy-goat/micro-app contains the following files

Loading the files please wait ...