---
title: "Introduction"
description: "Essential PHP utilities of Derafu for strings, arrays, dates, files, CSV, objects, IP addresses and URL paths"
type: "docs"
category: "doc"
tags: []
authors: [Anonymous]
date: "2026-10-08"
last_update: "2026-10-08"
time_minutes: 4
draft: false
unlisted: false
url: "https://www.derafu.dev/docs/core/support/introduction"
---

# Derafu: Support

[![GitHub](https://img.shields.io/badge/github-derafu%2Fsupport-blue?logo=github)](https://github.com/derafu/support)
![GitHub last commit](https://img.shields.io/github/last-commit/derafu/support/main)
![CI Workflow](https://github.com/derafu/support/actions/workflows/ci.yml/badge.svg?branch=main&event=push)
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/derafu/support)
![GitHub Issues](https://img.shields.io/github/issues-raw/derafu/support)
![Total Downloads](https://poser.pugx.org/derafu/support/downloads)
![Monthly Downloads](https://poser.pugx.org/derafu/support/d/monthly)

A collection of essential PHP utility classes for the common work of an application: strings, arrays, dates, files, CSV, objects, IP addresses and URL paths.

Every class is `final` and has only static methods. They keep no state: what a call does depends on its arguments (and on the clock or the file system, in the classes whose job is dates or files), so it gives the same answer anywhere and is easy to test.

## The classes

| Class | What it is for | Page |
| --- | --- | --- |
| `Str` | Placeholders, case conversion, slugs, multibyte padding, UUIDs and random strings. | [Strings](strings) |
| `Caster` | Turns a text into the scalar that it says (`"42"` is `42`). | [Strings](strings#caster) |
| `Encoding` | UTF-8 and ISO-8859-1, also inside arrays and objects. | [Strings](strings#encoding) |
| `Arr` | Dot notation, casting, trees, tables and subsets. | [Arrays](arrays) |
| `Date` | Spanish formatting, periods (`YYYYMM`), working days and units of time. | [Dates](dates) |
| `File` | Atomic writes, MIME types, ZIP and downloads. | [Files and CSV](files#file) |
| `Csv` | Reading, writing, generating and sending CSV. | [Files and CSV](files#csv) |
| `Obj`, `Factory`, `Hydrator` | Create objects from arrays and look at them. | [Objects](objects) |
| `Serialization`, `JsonSerializer` | Is it serializable, and objects to JSON. | [Objects](objects#serialization-and-json) |
| `Debug` | Information about a variable and where it was inspected. | [Objects](objects#debug) |
| `Ip` | IPv4 and IPv6: validation, normalization, ranges and networks. | [Ip](ip) |
| `Url` | The canonical form of the paths of URLs, and prefixes by segments. | [Url](url) |

## Why Derafu\Support?

It solves needs of business and data processing that the standard library leaves out:

- **Business dates:** working days, holidays, periods (`YYYYMM`) and ranges that skip weekends.
- **CSV across systems:** separators, enclosures and encodings.
- **Data transformations:** trees, tables and lists, without losing the data.
- **Safe files:** atomic writes, errors that say what failed, and the MIME type of a file.
- **Addresses that are handled right:** IPv6, ranges and networks, with the same canonical form for the same address.

## Install

```bash
composer require derafu/support
```

Only `derafu/translation` is required (see [Errors](#errors)). The libraries that some classes use are **not** required, because a project that does not use those classes does not need them. Install what you use:

| Package | Needed by |
| --- | --- |
| `nesbot/carbon` | `Date` (all of it). |
| `league/csv` (9.27 or later) | `Csv` (all of it). |
| `symfony/mime` | `File::mimetype()`, and `File::send()` for the type of the file it sends. |
| `symfony/filesystem` | `File::rmdir()`, which does not follow symbolic links. |
| `maennchen/zipstream-php` | `File::zip()` and `File::compress()`. |
| `ext-zip` | `File::unzip()`. |

The string classes (`Str`, `Encoding`) use the functions of `mbstring`.

## Errors

The errors that the classes throw are **translatable**: they are the standard exceptions of PHP (`InvalidArgumentException`, `RuntimeException`, `LogicException`) in the translatable version of [`derafu/translation`](https://www.derafu.dev/docs/core/translation), so catching the standard class works, and the message is also available as a message id with its parameters.

The Spanish translations ship with the package. To have them in your translator, import its services (or add `SupportTranslationResourceProvider` to the resource providers of the translator):

```yaml
imports:
    - { resource: '../vendor/derafu/support/resources/config/support-services.yaml' }
```

`derafu/foundation` already does it.



---
Last updated on 08/10/2026

