Download the PHP package moonlydays/laravel-mno without Composer

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

Laravel MNO

Tests Latest Version Total Downloads PHP Version Laravel

Laravel package for validating, normalizing, and working with MSISDN phone numbers tied to a single Mobile Network Operator. A wrapper around giggsey/libphonenumber-for-php with integration into Laravel's validation system, Eloquent casts, Faker, schema builder, and facades.

Released under the MIT License.

Requirements

Installation

Publish the configuration file:

Configuration

Set up the environment variables:

Variable Description
MNO_NAME Name of the mobile network operator
MNO_COUNTRY ISO 3166-1 alpha-2 country code (e.g., RU, TZ)
MNO_NETWORK_CODES Comma-separated National Destination Code (NDC) prefixes for the operator
MNO_MIN_LENGTH Minimum national number length (optional — inferred from libphonenumber metadata)
MNO_MAX_LENGTH Maximum national number length (optional — inferred from libphonenumber metadata)

When MNO_MIN_LENGTH / MNO_MAX_LENGTH are unset, the package infers the length from libphonenumber metadata for the configured country, walking the number_types priority list in config/mno.php (defaults to Mobile, then General).

Usage

Creating a Msisdn

Msisdn is a lightweight value object wrapping libphonenumber's native PhoneNumber. It implements Stringable (casting to string produces the E.164 form), JsonSerializable (serializes as E.164), and Castable (can be used directly as an Eloquent cast). It also uses Laravel's Macroable and Tappable traits.

Formatting

Retrieving number components

Two Msisdn instances can be compared via $a->equals($b) (equality is based on the E.164 form).

Timezones

Validation

Validation failures translate the following keys, which you can publish or override in your own language files:

Overriding the default rule

MsisdnRule::defaults() lets you swap in a custom resolver used by Rule::msisdn():

Request macro

The service provider registers a msisdn macro on Illuminate\Http\Request:

Eloquent cast

Since Msisdn implements Castable, you can use it directly as an Eloquent cast. MsisdnCast is also available if you prefer to be explicit:

The cast accepts a string, integer, or Msisdn instance when setting, and persists the E.164 digits as an unsigned integer (the leading + is stripped). When reading back, the configured MNO_COUNTRY is used as the default region for parsing, so make sure it is set.

Back the cast with an unsigned bigInteger column (e.g., $table->unsignedBigInteger('phone')). A VARCHAR column will break writes.

Faker provider

When the Faker generator resolves from the container, the package registers a provider for generating valid numbers within the configured MNO (country, network codes, and length constraints):

JSON resource

MsisdnFormatResource exposes the operator's format metadata as a JSON resource, for API responses that need to tell clients about expected number shape:

MNO facade

The facade resolves the MnoService singleton, which is also bound to the container alias mno and can be injected directly.

Country and Carrier value objects

Artisan command

Inspect the configured MNO, a country, or a specific carrier:

Extending via macros

Msisdn uses the Macroable trait, so you can add project-specific helpers:


All versions of laravel-mno with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
giggsey/libphonenumber-for-php Version ^9.0.27
giggsey/locale Version ^2.9
illuminate/contracts Version ^11.0||^12.0||^13.0
spatie/laravel-package-tools Version ^1.93
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 moonlydays/laravel-mno contains the following files

Loading the files please wait ...