Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Algerian Mobile Phone Number Laravel

Algerian Mobile Phone Number Laravel Laravel Package

cherif/algerian-mobile-phone-number-laravel

Laravel integration for the cherif/algerian-mobile-phone-number value object. Provides an Eloquent cast to store/read Algerian mobile numbers as a value object, plus a validation rule for request input. Install via Composer and use in models/forms.

View on GitHub
Deep Wiki
Context7

Allows to use cherif/algerian-mobile-number in Laravel

Frequently asked questions about Algerian Mobile Phone Number Laravel
Does this package work with Laravel 10.x and PHP 8.2+?
The package was last updated in 2020 and may not support Laravel 10.x or PHP 8.2+ out of the box. You’ll likely need to fork it, update dependencies, and test compatibility with newer Laravel versions. Check the underlying `cherif/algerian-mobile-phone-number` library for PHP version constraints.
How do I cast a database column to an AlgerianMobilePhoneNumber value object in Eloquent?
Add the `AlgerianMobilePhoneNumberCast` to your model’s `$casts` array. For example, `protected $casts = ['phone' => AlgerianMobilePhoneNumberCast::class];`. The package automatically handles conversion between strings (database) and the value object in your code.
Can I use this package for request validation in Laravel?
Yes. Use the `AlgerianMobilePhoneNumberRule` in your validation logic, like `'phone' => ['required', new AlgerianMobilePhoneNumberRule]`. It integrates directly with Laravel’s validator and Form Requests.
What happens if I store an invalid number in the database?
The package will throw a validation exception when retrieving the value object from the database if the stored string doesn’t match an Algerian mobile number format. Always validate input before saving to avoid runtime errors.
Are there any limitations with carrier detection or international numbers?
This package is specifically for Algerian mobile numbers and doesn’t handle international formats or carrier-specific logic beyond basic validation. If you need carrier detection, you may need to extend the underlying `cherif/algerian-mobile-phone-number` library or use a third-party service.
How do I handle edge cases like ported numbers or VoIP services?
The package relies on the core `cherif/algerian-mobile-phone-number` library, which may not account for all edge cases like ported numbers or VoIP. Test thoroughly with your dataset, and consider adding custom validation logic if needed.
Is this package actively maintained? Should I fork it?
The package hasn’t seen updates since 2020, so forking may be necessary to ensure compatibility with modern Laravel/PHP versions. If you plan to use it long-term, consider maintaining a private fork or contributing fixes upstream.
Can I use this alongside other Laravel validation packages like `laravel-phone`?
Yes, but ensure there are no conflicts in validation rules. This package is lightweight and focused on Algerian numbers, so it should coexist with other validation packages without issues.
How do I test this package in my Laravel application?
Write unit tests for validation rules using Laravel’s `Validator` facade and mock the underlying value object. For Eloquent casting, test model hydration/dehydration with both valid and invalid phone numbers to ensure proper behavior.
What’s the best alternative if this package doesn’t meet my needs?
For a more flexible solution, consider using a custom validation rule with regex and a carrier list, or explore libraries like `giggsey/libphonenumber-for-php` for broader international support. However, this package is ideal if you specifically need Algerian number validation with minimal setup.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope