# PackageName

> Validates the package names the native manager reads from manifests, lock files, and registry metadata.

[API reference](/docs/api/index.md) › [Foxy](/docs/extensions/foxy/reference/index.md) › [Native](/docs/extensions/foxy/reference/native/index.md) › PackageName

| final readonly class | `Foxy\Native\PackageName` |
| --- | --- |
| Source | [`src/Native/PackageName.php`](https://github.com/php-forge/foxy/blob/main/src/Native/PackageName.php#L16) |

Validates the package names the native manager reads from manifests, lock files, and registry metadata.

A valid name is at most 214 bytes long and is an optional `@scope/` prefix followed by a name, where the scope and
the name each start with an ASCII letter or digit and continue with letters, digits, `.`, `_`, or `-`.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`isValid()`](#method-isValid) static | Returns whether the name matches the grammar, which rules out empty parts, path separators outside the scope separator, leading dots, and absolute paths. | `PackageName` |

## Method details

### isValid() <span id="method-isValid"></span>

```php
public static function isValid(string $name): bool
```

Returns whether the name matches the grammar, which rules out empty parts, path separators outside the scope
separator, leading dots, and absolute paths.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$name` | `string` |  |

**Returns**

`bool`