Download the PHP package karelwintersky/arris.request without Composer

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

Arris.Request

Fluent-reader данных запроса (REQUEST) для экосистемы Arris µFramework. Включает:

Standalone-пакет.

Requirements

Installation

Usage

Минимальная форма

Источником данных по умолчанию является $_REQUEST. Вторым аргументом можно передать произвольный массив (например, протестировать обработчик формы):

import() — «пульт» для __invoke

Request::import($source = null) связывает источник (по умолчанию $_REQUEST) без конкретного поля и возвращает source-reader: его raw(), asArray() и asJson() отдают весь источник целиком. Каждый вызов $r('field') создаёт обычный читатель поля из того же источника:

Внимание: вызывать класс как функцию (Request('name')) нельзя — __invoke работает только на экземпляре.

Чейнинг преобразований

Step-методы возвращают $this и комбинируются в любом порядке.

apply() принимает любой callable: замыкание, строку-функцию ('strtolower'), массив [Class::class, 'method'] и т.д.

Встроенные шорткаты для частых преобразований:

Замыкающие методы (возвращают значение)

Метод Тип Поведение
raw() mixed сырое значение без преобразований; для import() — весь источник
asString() / asStr() string строковое приведение
asInt() int FILTER_VALIDATE_INT, иначе дефолт
asFloat() float FILTER_VALIDATE_FLOAT, иначе дефолт
asBool() bool true/1/on/yes → true; false/0/off/no/'' → false
asCheckbox() int asBool() ? 1 : 0 — для INT-колонки БД
asArray() array как есть, иначе (array)$default; пустой [] → default (если не allowEmptyArray()); для import() — весь источник
asEmail() string валидация FILTER_VALIDATE_EMAIL, иначе default
asUrl() string валидация FILTER_VALIDATE_URL, иначе default
asText() string очистка текста: strip_tags + htmlspecialchars, удаление пустых <div>/<p>, схлопывание пробелов
asJson() string JSON результата (Dataset::jsonize): весь источник для import()

Примеры:

Dataset — маппинг payload по правилам

Arris\Request\Dataset::map() строит новый массив из исходного по набору правил с приведением типов. Правило — ассоциативный массив с ключами:

В результат попадают только ключи правил. Falsy-значения (0, '', false, null) не считаются отсутствующими.

Есть также Dataset::castToType($value, $type) и Dataset::jsonize($data, $flags).

Testing

License

The MIT License (MIT).


All versions of arris.request with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-mbstring Version *
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 karelwintersky/arris.request contains the following files

Loading the files please wait ...