> For the complete documentation index, see [llms.txt](https://docs.opensoutheners.com/oss/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opensoutheners.com/oss/extended-laravel/facades.md).

# Facades

This package extends Laravel's framework facades with new useful methods.

### Arr

#### exceptValues

Filter array shorthand by just excluding the values passed as second argument.

```php
Arr::exceptValues([
    "hello" => "world",
    "foo" => "bar"
], "bar");

// ["hello" => "world"]
```

#### onlyValues

Filter array shorthand by just including the values passed as second argument.

```php
Arr::onlyValues([
    "hello" => "world",
    "foo" => "bar"
], "world");

// ["hello" => "world"]
```

#### query

Write a URL query string from an array.

```php
Arr::query([
    "q" => "this",
    "param2" => "value"
], "world");

// "?q=this&param2=value"
```

### Collection

#### toCsv

Converts collection of items to CSV with its headers.

```php
collect([
    [
        "name" => "Ruben Robles",
        "role" => "Admin"
    ],
    [
        "name" => "Taylor Otwell",
        "role" => "Admin"
    ]
])->toCsv(); // "name,role\nRuben Robles,Admin\nTaylor Otwell,Admin"
```

#### templateJoin

Join items of the collection using a template substitution.

```php
collect([
    [
        "name" => "Ruben Robles",
        "email" => "ruben.robles@example.com"
    ],
    [
        "name" => "Taylor Otwell",
        "email" => "taylor.otwell@laravel.com"
    ]
])->templateJoin(":name (:email)"); // "Ruben Robles (ruben.robles@example.com), Taylor Otwell (taylor.otwell@laravel.com)"
```

### Number

#### toShort

Get shorter version of a big number if possible.

```php
Number::toShort(1000); // "1K"
Number::toShort(2200); // "2,2K"
```

#### toByteUnit

Get byte unit version of a number.

```php
Number::toByteUnit(1000)->toKB(); // "1.00 KB"
```

## Storage

#### humanSize

Get human readable file size at given path.

```php
use OpenSoutheners\ByteUnitConverter\MetricSystem;

Storage::humanSize("path/file.png"); // "124.00 KB"
Storage::humanSize("path/file.png", MetricSystem::KiB); // "121.09 KiB"
```

### Str

#### parseQuery

Parse a URL query string into an array.

```php
Str::parseQuery("?q=search&param1=value"); // ["q" => "search", "param1" => "value"]

Str::of("?q=search&param1=value")->parseQuery();
```

#### isJsonStructure

Check if string contains a valid JSON structure.

```php
Str::isJsonStructure('{"foo": "bar"}'); // true

Str::of('"bar"')->isJsonStructure(); // false
```

#### emailDomain

Get domain part from email address.

```php
Str::emailDomain("ruben@example.com"); // "example.com"

Str::of("taylor.otwell@laravel.com")->emailDomain(); // "laravel.com"
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.opensoutheners.com/oss/extended-laravel/facades.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
