Download the PHP package mrhdolek/slim4-boirlerplate without Composer

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

Slim 4 Framework skeleton

CI Codecov.io License PHPStan Enabled PHP


An Slim 4 Framework skeleton using AMQP and DDD

I was inspired to create this skeleton from: robiningelbrecht.

Project setup

Development

If you have problems with permissions please add sudo before make example:

Run env for Windows

Please install packages makefile for Windows

Address where the environment is available

Some examples

Registering a new route

Head over to config/routes.php and add a route for your RequestHandler:

Console commands

The console application uses the Symfony console component to leverage CLI functionality.

Scheduling Commands

To schedule a command, we use the GO\Scheduler class. This class allows us to define the timing and frequency of command execution. Here's an example of how to schedule a command to run daily:

In this example, the app:user:create command is scheduled to run every day.

Running the Scheduler

The scheduler should be triggered by a system cron job to ensure it runs at regular intervals. Typically, you would set up a cron job to execute a PHP script that initializes and runs the scheduler.

For instance, a cron job running every minute might look like this:

This setup ensures that your scheduled commands are executed reliably and on time.

Domain event and event handlers

The framework implements the amqp protocol with handlers that allow events to be easily pushed onto the queue. Each event must have a handler implemented that consumes the event.

Creating a new event

Creating the corresponding event handler

Eventing

Create a new event

Async processing of commands with RabbitMQ

The chosen AMQP implementation for this project is RabbitMQ, but it can be easily switched to for example Amazon's AMQP solution.

Registering new queues

Queueing events

Consuming your queue

Create new entity

If you have created a new entity and want to map it to a database you must create a xml in src/Infrastructure/Persistence/Doctrine/Mapping . It must be named so as to indicate where exactly the entity to be mapped is located.

Binding of interfaces/Registry global objects

To register a dependency or create a single configured global instance, you need to go to config/container.php

Mapping database data to custom objects

To map data from a database to a custom object you need to extend something from Doctrine/DBAL/Types .

After extending, you need to add a note in the xml that you are mapping a field to an object.

Finally, you must add the new type in config/container.php where doctrine is configured

Database migrations

To manage database migrations, the doctrine/migrations package is used.

The mapping is done using a yaml which maps your entities from the domain to a structure in the database . If you change something in yaml, you can use the commands below to generate a migration based on the difference.

Swoole

To use swoole, just set DOCKER_TARGET_APP=swoole in .env and rebuild the application container.

Documentations

Learn more at these links:


All versions of slim4-boirlerplate with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-json Version *
ext-pcntl Version *
ext-sockets Version *
awurth/slim-validation Version ^5.0
doctrine/data-fixtures Version ^1.6
doctrine/migrations Version ^3.6
doctrine/orm Version ^2.15
fakerphp/faker Version ^1.23
laminas/laminas-diactoros Version ^3.3
lcobucci/clock Version ^3.1
monolog/monolog Version ^2.8
peppeocchi/php-cron-scheduler Version ^4.0
php-amqplib/php-amqplib Version ^3.2
php-di/php-di Version ^7.0
php-di/slim-bridge Version ^3.4
predis/predis Version ^2.2
ramsey/uuid Version ^4.7
slim/psr7 Version ^1.5
slim/slim Version ^4.10
slim/twig-view Version ^3.3
swoole/ide-helper Version ^5.1
symfony/cache Version ^6.3
symfony/console Version ^6.3
symfony/doctrine-bridge Version ^6.3
symfony/finder Version ^6.3
symfony/yaml Version ^6.2
thecodingmachine/safe Version ^2.5
vlucas/phpdotenv Version ^5.5
zircote/swagger-php Version ^4.7
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 mrhdolek/slim4-boirlerplate contains the following files

Loading the files please wait ....