Download the PHP package devsarfo/laraphone without Composer

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

LaraPhone

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Laravel Phone Number Package based on the libphonenumber for PHP (Lite). It is a simple Laravel package for validating, formatting, and parsing phone numbers based on the PHP port of Google’s libphonenumber library, providing robust support for international phone number handling.

Installation

You can install the package via composer using the following command. The command will install the latest applicable version of the package.

You can publish the config file with:

Optionally, you can publish the translations with :

Usage

Use the phone keyword in your validation rules array or use the DevSarfo\LaraPhone\Rules\PhoneNumberRule rule class to define the rule in an expressive way.

To put constraints on the allowed originating countries, you can explicitly specify the allowed country codes.

You can pass the country code from another field in the request. For example, to require a phone number to match the user's country.

The country codes should be ISO 3166-1 alpha-2 compliant.

Validation Message

We provide validation for various cases out of the box. However, to enable the custom phone validation message, please add the following line to the validation.php language file in your resources/lang/{language}/ directory (e.g., resources/lang/en/validation.php):

PhoneNumber Utility class

You can use the DevSarfo\LaraPhone\Models\PhoneNumber class to handle various phone number operations, such as formatting, validating, and manipulating phone numbers. It provides an easy-to-use interface for working with phone numbers in different formats, and can be safely referenced in views or when saving to the database.

Alternatively you can use the phone() function found in the Helper.php. It returns a DevSarfo\LaraPhone\Models\PhoneNumber instance or the formatted string if $format was provided:

Formatting

A PhoneNumber can be formatted in various ways:

Database

Store phone numbers in the E.164 format in your database. This format globally uniquely identifies a phone number, ensuring consistency and simplifying validation.

For example:

Why E.164 Format?

Example Workflow:

  1. User Input: 0244123456
  2. Format to E.164: +233244123456
  3. Save in Database: Store as +233244123456
  4. Display: Format it as needed, e.g., 0244 123 456 for Ghana.

This ensures unique, globally recognizable phone numbers that can be displayed differently based on user needs.

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 laraphone with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
giggsey/libphonenumber-for-php-lite Version *
illuminate/contracts Version ^10.0||^11.0||^12.0
spatie/laravel-package-tools Version ^1.16
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 devsarfo/laraphone contains the following files

Loading the files please wait ....