Download the PHP package laravel-enso/dynamic-methods without Composer

On this page you can find all versions of the php package laravel-enso/dynamic-methods. 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 dynamic-methods

Dynamic Methods

Stable Downloads Issues Merge Requests

Description

Dynamic Methods adds runtime-bound relations, instance methods, scopes, mutators, and static methods to Laravel models and classes.

The package scans Dynamics folders from configured vendor packages and from the host application, instantiates the dynamic definitions it finds, and binds their closures onto the target classes during boot.

In the Enso ecosystem it is the mechanism used to let independent packages augment shared models like User without editing those models directly.

Installation

Install the package:

The service provider is auto-registered and immediately binds all discovered dynamics on boot.

If you want to customize which vendor namespaces are scanned, publish the configuration:

Default configuration:

For application-level dynamics, place your classes under your app PSR-4 Dynamics folder. In a standard Laravel application this means app/Dynamics.

Features

Usage

To receive dynamic instance methods, relations, scopes, and mutators, a model should implement LaravelEnso\DynamicMethods\Contracts\DynamicMethods and use LaravelEnso\DynamicMethods\Traits\Abilities.

Example model:

Define a dynamic relation in a package or app Dynamics class:

Define a dynamic instance method:

After boot, the bound methods can be used as if they were defined on the model itself:

::: warning Note The binder discovers dynamics by reading package composer.json PSR-4 configuration and then scanning a Dynamics directory relative to that namespace root.

In practice, the package also relies on laravel-enso/helpers for JsonReader, even though that dependency is currently not declared in composer.json. :::

API

Configuration

config/dynamics.php

Keys:

The binder scans:

Service Provider

LaravelEnso\DynamicMethods\AppServiceProvider

Responsibilities:

Contracts

Definition contracts require:

Traits

Abilities extends Methods and also makes dynamic scopes, accessors, and mutators discoverable through Eloquent's standard model checks.

Services

Depends On

Required Enso packages:

Framework dependency:

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!


All versions of dynamic-methods with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/framework Version ^10.0|^11.0|^12.0|^13.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 laravel-enso/dynamic-methods contains the following files

Loading the files please wait ...