Download the PHP package lyhty/macros without Composer

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

Latest Version on Packagist PHP Laravel Total Downloads StyleCI License

This package provides some additional, convenient macros for you to use with your Laravel project.

Installation

Install the package with Composer:

composer require lyhty/macros

The package registers itself automatically.

Macros

Here's a brief documentation on the macros the package provides.

Illuminate\Database\Eloquent\Builder

Builder::selectKey

Select the key of the model in the query (uses Model's getKey method).

Illuminate\Database\Query\Builder

Builder::whereLike & orWhereLike

⚠️ This macro relies on Str::explodeReverse macro. If you want to disable the latter macro, this macro will no longer function.

⚠️ The Builder::orWhereLike macro relies on Builder::whereLike macro. If you want to disable the whereLike macro, be sure to disable the orWhereLike macro as well.

Builder::selectRawArr

Add raw select statements as an array, instead of as a one ugly string (selectRaw).

Illuminate\Support\Collection

Collection::mergeMany

Merge multiple arrays/collections to the collection in one go.

Collection::pick (was pluckMany)

Pick several keys from the collection items. The first value should be an array of keys you want to pick up from the collection items. The second value determines whether keys will be preserved and in which format:

Collection::whereExtends

Filter classes and/or objects that extend the given class.

Collection::whereImplements

Filter classes and/or objects that implement the given interface.

Collection::whereUses

Filter classes and/or objects that use the given trait.

Illuminate\Support\Arr

Arr::associate

Converts an array into a fully associative array by converting any values with an integer key to the value being the key filled with the given fill value. Values that have a string key already won't be touched.

Arr::combine

Similar to array_combine, but allows to have more keys than values. Keys without value will be set as null.

Arr::fillKeys

Fills given keys with given value. You can also set that only keys that already exist in the array can become filled. In other words, if the key foo is to be filled with value bar, but the key foo doesn't already exist in the array, the array will remain unchanged.

Arr::implode

Implodes given array with given separator to a \Illuminate\Support\Stringable instance.

Arr::join

Collection's nice join method brought to Arr.

Arr::zip

Zips the key and value together with the given zipper.

Arr::unzip

Unzips keys to key and value with the given zipper.

Str::explodeReverse

Explodes the given string from the end instead of the start and returns it as a Illuminate\Support\Collection class instance.

Illuminate\Support\Str

Str::wrapWith

Wraps the string with given character(s).

⚠️ As Laravel 9 introduced Str::wrap macro, as of v4.0 this macro is now called Str::wrapWith to avoid conflicts. Note: the behavior between these two macros is different:

Illuminate\Support\Stringable

Stringable::explodeReverse

⚠️ This macro relies on Str::explodeReverse macro. If you want to disable that macro, this macro will no longer function.

See Illuminate\Support\Str::explodeReverse

Stringable::wrapWith

⚠️ As Laravel 9 introduced Str::wrap macro, as of v4.0 this macro is now called Str::wrapWith to avoid conflicts.

⚠️ This macro relies on Str::wrapWith macro. If you want to disable that macro, this macro will no longer function.

See Illuminate\Support\Str::wrapWith

Carbon\CarbonPeriod

CarbonPeriod::collect

License

Lyhty Macros is open-sourced software licensed under the MIT license.


All versions of macros with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1 | ^8.2
illuminate/support Version ^10.0 | ^11.0
illuminate/console Version ^10.0 | ^11.0
lyhty/macronite Version dev-main | ^3.1
lyhty/support Version dev-main | ^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 lyhty/macros contains the following files

Loading the files please wait ....