Download the PHP package prismaticoder/maker-checker-laravel without Composer

On this page you can find all versions of the php package prismaticoder/maker-checker-laravel. 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 maker-checker-laravel

prismaticoder/maker-checker-laravel

The prismaticoder/maker-checker-laravel package is a comprehensive Laravel package that provides a flexible and customizable maker-checker system for your application. It allows you to implement an approval workflow for various actions in your application, such as creating, updating, and deleting records. It also allows you to be able to execute random actions. With this package, you can ensure that important actions go through an approval process before they are finalized.

Features

Requirements

The Maker-Checker Laravel package requires PHP version 8 or higher and Laravel version 8 or higher to function properly. Before installing the package, make sure your development environment meets these requirements.

You can check your PHP version by running the following command in your terminal:

Installation

You can install the prismaticoder/maker-checker-laravel package via Composer. Run the following command in your terminal:

Configuration

After installing the package, you need to publish the configuration and migration files to customize the maker-checker settings. Run the following command:

Migration:

Config:

This will create a config/makerchecker.php file in your application's config as well as a create_maker_checker_requests_table migration file in your database/migrations folder

Usage

Retrieving requests

The package exposes a MakerCheckerRequest model that can be queried like any other Laravel model

Initiating a new request

One of the ways of initiating a new request is by making use of the MakerChecker Facade class. Here's an example of how to initiate a request to create a user:

Alternatively, you can choose to include the MakesRequests trait in your maker model.

With this included, the above requests can now be constructed in the format below

You can also give the request a custom description with the description() method.

The Executable Request Type

Asides the generic actions of creating, updating and deleting models, it is also possible that you would want to perform miscellaneous requests that do not directly fall into any of this categories e.g making an http call to an external system, combining different actions etc. It is for this reason that the concept of an executable request was added.

To initiate a new executable request, you first need to create an executable request class that extends the Primaticode\MakerChecker\Contracts\ExecutableRequest contract:

Here, we have an executable request that does something basic when approved: it facilitates a payment based on parameters within the request payload.

To initiate a request to perform this, we use the requestToExecute() method:

When this request is approved, a call will be made to the execute() method of the executable class to facilitate the action specified.

Customizing the Request with tap()

The request builder provides a tap() method that allows you to customize the underlying request object by applying actions or modifications. The tap() method accepts a closure function as its argument, where you can perform various operations on the request.

Here's an example:

In the above example, the tap() method is used to customize the request by setting the value of a custom field in the table storing the requests.

Note that the tap() method is optional and can be used whenever you need to perform additional actions or modifications on the request before it is initiated.

By leveraging the tap() method, you have the flexibility to customize the request object according to your specific requirements, ensuring that it captures all the necessary details for the maker-checker process.

Approving/Rejecting a Request

To approve or reject a Maker-Checker request, you can use the MakerChecker facade as well. Here's an example of how to approve a request:

In the example above, we use the approve() method of the MakerChecker facade to approve a request. We pass an instance of the request model and the user who is approving the request.

Similarly, you can use the reject() method to reject a request:

Just like the MakesRequests trait, this package also provides a ChecksRequests traits that can be included in the checking model:

With the above done, approval and rejection can now look like this:

Event Listeners and User-Defined Callbacks

The Maker-Checker package fires events at different stages of the request lifecycle, allowing you to listen to these events and perform additional actions as needed. In addition to event listeners, you can also pass in user-defined callbacks when initiating a request to specify actions to be performed after/before the request is approved or rejected.

Listening to Events

You can listen to the Maker-Checker events by registering event listeners in your application. Here's an example of how to listen to the events provided by the package

In the example above, we use the Event::listen() method to register a listener for the four events exposed by the package. The event listener receives an instance of the event and can then proceed to take actions on the request as passed in the event.

User-Defined Callbacks

When initiating a Maker-Checker request, you can also pass in user-defined callbacks to specify actions to be performed after/before the request is approved or rejected. Here's an example of how to use user-defined callbacks:

These five different methods can be chained to determine actions to happen during different events in the request lifecycle.

That's it! You're now equipped with event listeners and user-defined callbacks to extend the functionality of the Maker-Checker package in your Laravel application.

Credits

This package draws some inspiration from the excellent spatie/laravel-activitylog package by Spatie. I'm thankful for their constant work in developing the Laravel ecosystem.

Contributing

I'm happy to receive contributions from the community to enhance and improve this package. Feel free to submit bug reports, feature requests, or pull requests here.

License

The prismaticoder/maker-checker-laravel package is open-source software licensed under the MIT license. Please refer to the LICENSE file for more information.


All versions of maker-checker-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/config Version ^8.0 || ^9.0 || ^10.0
illuminate/database Version ^8.0|^9.0|^10.0
illuminate/support Version ^8.0|^9.0|^10.0
laravel/serializable-closure Version ^1.2.2
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 prismaticoder/maker-checker-laravel contains the following files

Loading the files please wait ....