Download the PHP package lemaur/laravel-typed-config without Composer

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

Laravel Typed Configuration

Latest Version on Packagist Total Downloads License Tests GitHub Sponsors Trees

This package provides an object-oriented way to retrieve the configuration data with the right type.

If you are familiar with static analysis tool like phpstan, you've probably encountered Cannot cast mixed to string error (or similar).

This is usually happen when you try to cast a value returned from a method/function with a mixed return type. Most of the time, in my personal case, the method is config() and following you can see an example:

With this package you can get a string value (and not only string) directly from the configuration like:


Support Me

Hey folks,

Do you like this package? Do you find it useful, and it fits well in your project?

I am glad to help you, and I would be so grateful if you considered supporting my work.

You can even choose 😃:


Installation

You can install the package via composer:


Usage

Retrieving Stringable Configuration Value

You may use the string method to retrieve the configuration data as an instance of Illuminate\Support\Stringable:

Retrieving Boolean Configuration Value

You may use the boolean method to retrieve the configuration data as a boolean. The boolean method returns true for 1, "1", true, "true", "on", and "yes". All other values will return false:

Retrieving Integer Configuration Value

You may use the integer method to retrieve the configuration data as an integer:

Retrieving Float Configuration Value

You may use the float method to retrieve the configuration data as a float:

Retrieving Date Configuration Value

You may use the date method to retrieve the configuration data as a Carbon instance:

The second and third arguments accepted by the date method may be used to specify the date's format and timezone, respectively:

In case of an invalid format, an InvalidArgumentException will be thrown.

Retrieving Enum Configuration Value

You may use the enum method to retrieve the configuration data as a PHP enum instance. In case of an invalid value or the enum does not have a backing value that matches the input value, null will be returned. The enum method accepts the name of the input value and the enum class as its first and second arguments:

Retrieving Configuration Value as a Collection

You may use the collect method to retrieve the configuration data as an Illuminate\Support\Collection instance:


Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-typed-config with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
spatie/laravel-package-tools Version ^1.14.0
illuminate/contracts Version ^10.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 lemaur/laravel-typed-config contains the following files

Loading the files please wait ....