A handful of tools for PHP developers.

Related tags

Developer Tools belt
Overview

Belt

Build Status

A handful of tools for PHP developers.

Version 2.0.0 is out now. Clear documentation, improved tests and code quality.

Installation

In case you want to try it out, run:

php composer.phar require "ilya/belt:~2"

That will add Belt to your project as a Composer dependency.

Example

A little taste of Belt:

use Belt\Belt;

Belt::max([1, 2, 3]) // => 3

Belt::flatten([1, [2, [3]]]) // => [1, 2, 3]

Belt::last([1, 2, 3], 2) // => [2, 3]

What It Offers

  • 60+ useful functions that you can use in your projects.
  • Belt is fully tested.
  • The source code is clean and documented.

Here is what is available to you:

  • boolean isDate(mixed $value)
  • boolean isNumber(mixed $value)
  • boolean isString(mixed $value)
  • boolean isFunction(mixed $value)
  • boolean isEmpty(mixed $value)
  • boolean isEqual(mixed $left, mixed $right)
  • boolean isBoolean(mixed $value)
  • boolean isObject(mixed $value)
  • boolean isArray(mixed $value)
  • boolean isTraversable(mixed $value)
  • boolean isNull(mixed $value)
  • boolean has(mixed $object, string $key)
  • array keys(mixed $object)
  • array values(mixed $object)
  • array methods(mixed $object)
  • mixed copy(mixed $value)
  • mixed extend(mixed $source, mixed $destination)
  • mixed apply(mixed $object, Closure $closure)
  • mixed defaults(mixed $object, array|mixed $defaults)
  • string escape(string $string)
  • string id(string $prefix = '')
  • mixed with(mixed $value)
  • void times(integer $number, Closure $closure)
  • mixed cache(Closure $closure)
  • mixed wrap(Closure $closure, Closure $wrapper)
  • mixed compose(array $closures, array $arguments = array())
  • void once(Closure $closure)
  • mixed after(integer $number, Closure $closure)
  • mixed|array first(array $elements, integer $amount = 1)
  • array initial(array $elements, integer $amount = 1)
  • array rest(array $elements, integer $index = 1)
  • mixed|array last(array $elements, integer $amount = 1)
  • array pack(array $elements)
  • array flatten(array $elements)
  • array range(integer $to, integer $from = 0, integer $step = 1)
  • array difference(array $one, array $another)
  • array unique(array $elements, Closure $iterator = null)
  • array without(array $elements, array $ignore)
  • array zip(array $one, array $another)
  • integer indexOf(array $elements, mixed $element)
  • array intersection(array $one, array $another)
  • array union(array $one, array $another)
  • void each(array $collection, Closure $iterator)
  • array map(array $collection, Closure $iterator)
  • array toArray(mixed $value)
  • integer|null size(array|Countable $value)
  • array shuffle(array $collection)
  • boolean any(array $collection, Closure $iterator)
  • boolean all(array $collection, Closure $iterator)
  • array reject(array $collection, Closure $iterator)
  • array pluck(array $collection, string $key)
  • boolean contains(array $collection, mixed $value)
  • array invoke(array $collection, string $function)
  • mixed reduce(array $collection, Closure $iterator, mixed $initial = 0)
  • array sortBy(array $collection, Closure $iterator)
  • array groupBy(array $collection, Closure $iterator)
  • mixed max(array $collection)
  • mixed min(array $collection)

Development

Plans

  • Add PHP 5.6 support - leverage variadic functions.

Features

  • Collections [done]
    • each [done]
    • map [done]
    • reduce [done]
    • max [done]
    • min [done]
    • size [node]
    • toArray [done]
    • groupBy [done]
    • sortBy [done]
    • shuffle [done]
    • all [done]
    • any [done]
    • pluck [done]
    • contains [done]
    • invoke [done]
    • reject [done]
  • Arrays [done]
    • first [done]
    • initial [done]
    • rest [done]
    • last [done]
    • pack [done]
    • flatten [done]
    • without [done]
    • unique [done]
    • union [done]
    • difference [done]
    • zip [done]
    • intersection [done]
    • range [done]
    • indexOf [done]
  • Functions [done]
    • cache [done]
    • once [done]
    • wrap [done]
    • after [done]
    • compose [done]
  • Objects [done]
    • keys [done]
    • values [done]
    • copy [done]
    • extend [done]
    • defaults [done]
    • methods [done]
    • apply [done]
    • has [done]
    • isEqual [done]
    • isEmpty [done]
    • isObject [done]
    • isArray [done]
    • isTraversable [done]
    • isFunction [done]
    • isString [done]
    • isNumber [done]
    • isBoolean [done]
    • isDate [done]
    • isNull [done]
  • Utilities [done]
    • with [done]
    • times [done]
    • id [done]
    • escape [done]

License

Belt is licensed under the MIT license.

You might also like...
A complete Notion SDK for PHP developers.

notion-sdk-php A complete Notion SDK for PHP developers. Installation composer require mariosimao/notion-php Getting started A Notion token will be n

The phponline.dev project - an online community for PHP developers.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Remita Clone for PHP-CURL Developers

REMITA - Empower your Customers to pay you easily as you grow Description Remita clone app (PHP) was build to ease programmers to integerate remita pa

Very flexible git hook manager for php developers
Very flexible git hook manager for php developers

CaptainHook CaptainHook is an easy to use and very flexible git hook library for php developers. It enables you to configure your git hook actions in

A simple package that helps PHP developers to generate the QR code signature as per Zakat authority (ZATCA) requirements of Saudi Arabia.

A PHP package that implements the e-invoice QR code signature requirements as designed by the Zakat authority of Saudi Arabia. How to install? compose

FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF.

FPDI - Free PDF Document Importer ❗ This document refers to FPDI 2. Version 1 is deprecated and development is discontinued. ❗ FPDI is a collection of

This a php environment for developers. based on Vagrant & CentOS & laravel/homestead

Centstead 这是一个 PHP 调试环境 , 基于 centos,laravel/homestead. 介绍   基于开发的实际需求,PHP开发者通常需要一个贴近生产环境,又易于维护的测试与开发环境.以往的选择: xampp, wamp, phpstudy… 集成环境,启动方便,占用小,但是需

Google Translator Api Wrapper For Php Developers.

Google Translator Api Wrapper For Php Developers.

This package makes it easy for developers to access WhatsApp Cloud API service in their PHP code.
This package makes it easy for developers to access WhatsApp Cloud API service in their PHP code.

The first PHP API to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform

✌ An elegant PHP framework for web developers
✌ An elegant PHP framework for web developers

About Attla framework Attla framework is a PHP framework with expressive, elegant syntax, facilitating common tasks used in many web projects. We buil

The SDK written in PHP for Close partner developers.

Close SDK for PHP The Close SDK for PHP makes it easy for developers to communicate with The Close App in their PHP code. Get started really fast by i

Rinvex Authy is a simple wrapper for @Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.
Rinvex Authy is a simple wrapper for @Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest API for developers and a strong authentication platform for the enterprise.

Rinvex Authy Rinvex Authy is a simple wrapper for Authy TOTP API, the best rated Two-Factor Authentication service for consumers, simplest 2fa Rest AP

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. /// Chat with us and others on Spectrum: https://spectrum.chat/twill
Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. /// Chat with us and others on Spectrum: https://spectrum.chat/twill

About Twill Twill is an open source Laravel package that helps developers rapidly create a custom CMS that is beautiful, powerful, and flexible. By st

There is no better way to learn than by watching other developers code live. Find out who is streaming next in the Laravel world.
There is no better way to learn than by watching other developers code live. Find out who is streaming next in the Laravel world.

Larastreamers This is the repository of https://larastreamers.com. It shows you who is live coding next in the Laravel world. Installation Steps clone

PHPStan Rules for Rector developers

Rector PHPStan Rules PHPStan rules for Rector and projects that maintain Rector rulesets. Install composer require rector/phpstan-rules --dev Do you u

WordPlate is a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.
WordPlate is a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

WordPlate is simply a wrapper around WordPress. It makes developers life easier. It is just like building any other WordPress website with themes and plugins. Just with sprinkles on top.

AdoteUm.Dev has the proposal to connect people who are looking for developers for their projects

AdoteUm.Dev has the proposal to connect people who are looking for developers for their projects. AdoteUmDev is a web application, developed in PHP language and the Laravel Framework.

The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.

netz98 magerun CLI tools for Magento 2 The n98 magerun cli tools provides some handy tools to work with Magento from command line. Build Status Latest

Humanize values that are readable only for developers.

PHP Humanizer Tests - 4.x Readme for 4.x version Humanize values to make them readable for regular people ;) Installation Run the following command: c

Comments
  • IDE & Static

    IDE & Static

    IDE will no longer display warnings(spl_object_hash takes object as argument). Static method calls should work fine now(at least method after(), from Functions doesn't work as expected for static calls).

    opened by getjump 3
  • does belt supported when i using php with version 5.2.*?

    does belt supported when i using php with version 5.2.*?

    i am using php with 5.2.*, i real like this tools and do not want to write same code again.

    can someone tell me , is it supported by php version 5.2.* ?

    opened by joostshao 1
  • Fixed without method not in strict mode

    Fixed without method not in strict mode

    Hey there,

    The documentation says the without method uses === but it's not currently the case as in_array's third argument is set to false by default.

    This pull request fixes this.

    opened by OwlyCode 1
Owner
Ilya
Ilya
A PHP-based sandboxing library with a full suite of configuration and validation options.

A full-scale PHP 5.4+ sandbox class that utilizes PHP-Parser to prevent sandboxed code from running unsafe code. It also utilizes FunctionParser to di

Corveda 192 Dec 10, 2022
A PHP README File Generator, to generate easily your GitHub README files 🎉

Readme Generator ?? Requiremennts ?? Make sure you have PHP 8.0 or higher installed. Steup ⚙️ Install Composer v2 or higher (https://getcomposer.org)

♚ PH⑦ de Soria™♛ 9 Oct 18, 2022
Builder - A handful of tools for Rapid Laravel Development

Grafite Builder Grafite has archived this project and no longer supports or develops the code. We recommend using only as a source of ideas for your o

Grafite Inc 997 Dec 22, 2022
PHP SDK for the Sellix Developers API (developers.sellix.io)

PHP SDK for the Sellix Developers API (developers.sellix.io). Quickly get started and create products, payments and more using PHP.

Sellix 7 Nov 23, 2022
DooTask is a lightweight open source online project task management tool that provides various document collaboration tools, online mind mapping, online flowcharting, project management, task distribution, instant IM, file management and other tools.

DooTask is a lightweight open source online project task management tool that provides various document collaboration tools, online mind mapping, online flowcharting, project management, task distribution, instant IM, file management and other tools.

kuaifan 3k Jan 5, 2023
MeiliSearch PHP is the MeiliSearch API client for PHP developers.

MeiliSearch PHP is the MeiliSearch API client for PHP developers. ⚡ The MeiliSearch API client written for PHP ??

MeiliSearch 362 Jan 4, 2023
php database agnostic authentication library for php developers

Whoo Whoo is a database agnostic authentication library to manage authentication operation easily. Whoo provides you a layer to access and manage user

Yunus Emre Bulut 9 Jan 15, 2022
😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.

Tracy - PHP debugger Introduction Tracy library is a useful helper for everyday PHP programmers. It helps you to: quickly detect and correct errors lo

Nette Foundation 1.6k Dec 23, 2022
PHPLucidFrame (a.k.a LucidFrame) is an application development framework for PHP developers

PHPLucidFrame (a.k.a LucidFrame) is an application development framework for PHP developers. It provides logical structure and several helper utilities for web application development. It uses a functional architecture to simplify complex application development. It is especially designed for PHP, MySQL and Apache. It is simple, fast, lightweight and easy to install.

PHPLucidFrame 19 Apr 25, 2022
Mind is the PHP code framework designed for developers. It offers a variety of solutions for creating design patterns, applications and code frameworks.

Mind Mind is the PHP code framework designed for developers. It offers a variety of solutions for creating design patterns, applications and code fram

null 0 Dec 13, 2021