Download the PHP package alexkart/typed-registry-laravel without Composer

On this page you can find all versions of the php package alexkart/typed-registry-laravel. 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 typed-registry-laravel

typed-registry-laravel

Laravel integration for typed-registry following Laravel best practices for environment variable and configuration access.

Tests PHPStan Level

Why?

Laravel's env() and config() helpers return mixed values, making strict type checking difficult. This package provides:

Installation

Requires:

The package uses Laravel's auto-discovery feature. The service provider and facade are registered automatically.

Quick Start

Environment Variables in Config Files

Following Laravel Best Practices: Environment variables should ONLY be accessed in config files, never directly in controllers or services.

Configuration Access Everywhere

Use the TypedConfig facade or typedConfig() helper in controllers, services, and anywhere else:

Features

typedEnv() Helper - For Config Files Only

Wraps Illuminate\Support\Env with intelligent type casting for numeric strings:

Casting Rules:

typedEnvString() Helper - For String Values

Use this helper when you have environment variables that are semantically strings but may contain only digits (passwords, tokens, API keys):

Casting Rules:

TypedConfig Facade - Use Anywhere

Wraps Laravel's Config facade with strict typing, no casting:

Or use the helper function:

Full API

All three helpers (typedEnv(), typedEnvString(), and TypedConfig) expose the same 20 methods from TypedRegistry:

Primitive Getters

Nullable Variants

With Defaults (Never Throws)

Lists (Sequential Arrays)

Maps (Associative Arrays with String Keys)

Type Casting Behavior

EnvProvider - Intelligent Casting

The EnvProvider (used by typedEnv()) intelligently casts numeric environment variable strings:

EnvStringProvider - Cast to String

The EnvStringProvider (used by typedEnvString()) casts all scalar values to strings:

ConfigProvider - No Casting

ConfigProvider performs zero type coercion. Values must be stored with the correct type:

Error Handling

Strict Getters Throw on Type Mismatch

Default Getters Never Throw

Real-World Example

PHPStan Integration

The package works seamlessly with PHPStan at max level:

Development

Quality Standards:

Comparison with Core Package

Feature alexkart/typed-registry alexkart/typed-registry-laravel
Framework Framework-agnostic Laravel-specific
Type Casting None (strict only) EnvProvider casts numeric strings
String Preservation N/A EnvStringProvider keeps all as strings
Facades No TypedConfig
Helper Functions No typedEnv(), typedEnvString(), typedConfig()
Auto-discovery N/A Yes
Laravel Best Practices N/A Enforced (env only in config)

Contributing

Contributions are welcome! Please ensure:

  1. All tests pass (vendor/bin/phpunit)
  2. PHPStan Level 10 passes (vendor/bin/phpstan analyse)
  3. Code follows existing style (strict types, final classes)

License

MIT License. See LICENSE for details.

Credits


Questions? Open an issue on GitHub.


All versions of typed-registry-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
alexkart/typed-registry Version ^0.1
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
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 alexkart/typed-registry-laravel contains the following files

Loading the files please wait ...