Download the PHP package kobylinski/beetroot without Composer

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

Beetroot

This package provides tools to enhance Laravel commands with additional features, like validation for input arguments and options.

Installation

Install the package via Composer:

Input Validation

The WithValidate trait allows you to define validation rules for your command's input arguments and options. This ensures that the data passed to your command is clean and adheres to specific requirements.

Usage

  1. Add the WithValidate trait to your command.
  2. Define a rules method in your command class to specify validation rules.

Example

Custom Validation Messages

You can define custom error messages for specific validation rules by adding a messages method to your command.

Nested Subcommands

This helper allows you to define subcommands directly in the command's $signature, simplifying the creation of complex CLI tools with hierarchical structures.

Defining Subcommands

The helper introduces the ability to:

Example Signature

How It Works

  1. Top-Level Command: The main command (user in this example).
  2. Subcommands: Nested command groups (e.g., add, find, suspend|restore).
  3. Arguments and Options: Each subcommand can define its own arguments and options.
  4. Multi-level Nesting: Subcommands can themselves have nested subcommands (e.g., token with its own subcommands).

Handling Subcommands in handle

Your handle method processes the input, determines the subcommand invoked, and executes the corresponding logic.

Running the Command

Benefits

WithNamedParameters Trait

The WithNamedParameters trait adds the ability to define validation rules with named parameters in your Laravel application. This feature simplifies rule customization and parameter management in complex validation scenarios.

Key Features

Example Usage

Validation Rule Definition

Define your validation rules with named parameters:

Parameter Configuration Overview

In this example, the rule string my_rule:value1,strict,true,1.2.3 maps directly to the following attributes:

These parameters are automatically accessible within the rule as class properties:

Abstract Example of a Custom Rule

Here’s a generalized implementation of a custom rule:

Attributes

NamedParameter

Define attributes for your custom validation parameters. Each NamedParameter can include:

Value

Defines a single value parameter with its name and an optional default value. You can specify a dictionary of allowed values to restrict input to predefined options.

Flag

Defines a boolean flag that can be included in the rule definition to toggle behavior.

Sequence

Defines a list of expected values that can be validated as part of the rule.

Rule

Associates a name with the validation rule for registration.

Example Validator Configuration

Here’s an example of how to use a custom rule in your validation:

Adding New Rules

To add a new rule with named parameters:

  1. Create the rule using the Artisan command:

  2. Open the newly created rule file in app/Rules/MyCustomRule.php.
  3. Use the WithNamedParameters trait.
  4. Annotate the validate method with NamedParameter attributes.

    Example:

  5. Implement your validation logic in the validate method.
  6. Call the register() method to register the rule.

Registering Custom Rules

You can register your rule in a service provider:


All versions of beetroot with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
illuminate/console Version ^10.0|^11.0
illuminate/support Version ^10.0|^11.0
illuminate/validation Version ^10.0|^11.0
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 kobylinski/beetroot contains the following files

Loading the files please wait ....