Download the PHP package anouar-touati/algerian-cities-laravel without Composer
On this page you can find all versions of the php package anouar-touati/algerian-cities-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anouar-touati/algerian-cities-laravel
More information about anouar-touati/algerian-cities-laravel
Files in anouar-touati/algerian-cities-laravel
Package algerian-cities-laravel
Short Description A package to facilitate working with algerian cities dataset in Laravel
License MIT
Informations about the package algerian-cities-laravel
Algerian Cities Laravel Package
Grew tired of repeating the same step in every project to add address to your forms. I had the same frustration, which why I made this package to get you up and running with just few commands.
Acknowledgment
Dataset was taken from this repo
Status
This package is still under development. Use at your own discretion. You can open an issue for bugs or features you would like to be included in the future.
Instalation
If auto discovery does not work for you, add this under providers in config/app.php :
Usage
API
Call these json endpoints
Verb | URI | Description |
---|---|---|
Get | /api/algeriancities/wilayas | Get all wilayas |
response format :
Verb | URI | Description |
---|---|---|
Get | /api/algeriancities/dairas/{wilaya} | Get all dairas at the specified wilaya code or name (arabic or french) |
response format :
Verb | URI | Description |
---|---|---|
Get | /api/algeriancities/communes/{daira} | Get all communes at the specified daira name (arabic or french) |
response format :
Verb | URI | Description |
---|---|---|
Get | /api/algeriancities/postoffices/{commune} | Get all post offices at the specified commune name (arabic or french) |
response format :
Use through the AlgerianCitiesFacade
you can use the methods that the API controller is built with by including this line to the top of your file :
All of these methods return a Collection | Mehod | Parameters | Description |
---|---|---|---|
getAllWilayas() | returns all wilayas | ||
getDairasUsingWilayaCode() | $wilaya_code | get list of dairas using wilaya's code | |
getDairasUsingWilayaName() | $wilaya_name | get list of dairas using wilaya's name in arabic or french | |
getCommunesUsingDairaName() | $daira_name | get list of communes using daira's name in arabic or french | |
getPostsUsingCommuneName() | $commune_name | get list of post offices using commune's name in arabic or french | |
getAllDairas() | get list of all dairas | ||
getAllCommunes() | get list of all communes |
Built-in address Blade component
You can add this ready to use component to your form which will provide the HTML dropdowns for selecting the address and the logic to populate them.
You can add styling by passing values to the :select_style
and :label_style
props as shown below.
You also need to have the Blade directive @stack
with the word scripts like so @stack('scripts')
under the closing body tag if you dont have that already.
Example:
Localization
English, French and Arabic translations are available by default for the address form.
If you want to override the default translations you may do so,
publish the file to lang/vendor/algerian-cities-laravel
by running the following command: