Recommend this page to a friend! |
Classes of NN | Laravel World | README.md | Download |
|
Download <p><img src="https://eu.ui-avatars.com/api/?name=Najm+Njeim?size=100" width="100"/></p> A Laravel package to provide a list of the countries, states, cities, timezones, currencies and phone numbers formatting/validation helpers. The package can be consumed through Facades, Helpers and Api routes. Installation
ChangelogPlease see CHANGELOG for more information what has changed recently. UsageWorld FacadeList all the countries.
Fetch a country with its states and cities.
World Helper ClassList all the cities by country id.
Available methods| Name | Description | Argument* | | :--- | :--- |:--- | | countries | lists all the world countries | arraycontaining (string) fields and (array) filters* | | states | lists all the states | arraycontaining (string) fields and (array) filters* | | cities | lists all the cities | arraycontaining (string) fields and (array) filters* | | timezones | lists all the timezones | arraycontaining (string) fields and (array) filters* | | currencies | lists all the currencies | arraycontaining (string) fields and (array) filters* | The methods' return is structured as below:
Countries method
States method
Cities method
Timezones method
Currencies method
Available routesAll routes can be prefixed by any string. Ex admin, api, v1 ... Countries| | | | :--- | :--- | | Method | GET | | Route | /{prefix}/countries | | Parameters* | comma seperated fields(countries table fields in addition to states, cities, currency and timezones), array filters | | Example | /v1/countries?fields=iso2,cities&filters[phone_code]=44 | | response | success, message, data | States| | | | :--- | :--- | | Method | GET | | Route | /{prefix}/states | | Parameters* | comma seperated fields(states table fields in addition to country and cities), array filters | | Example | /v1/states?fields=country,cities&filters[country_id]=182 | | response | success, message, data | Cities| | | | :--- | :--- | | Method | GET | | Route | /{prefix}/cities | | Parameters* | comma seperated fields(states table fields in addition to country and state), array filters | | Example | /v1/cities?fields=country,state&filters[country_id]=182 | | response | success, message, data | Timezones| | | | :--- | :--- | | Method | GET | | Route | /{prefix}/timezones | | Parameters* | comma seperated fields(states table fields in addition to the country), array filters | | Example | /v1/timezones?fields=country&filters[country_id]=182 | | response | success, message, data | Currencies| | | | :--- | :--- | | Method | GET | | Route | /{prefix}/timezones | | Parameters* | comma seperated fields(states table fields in addition to the country), array filters | | Example | /v1/timezones?fields=country&filters[country_id]=182 | | response | success, message, data | Validate Number| | | | :--- | :--- | | Method | POST | | Route | /{prefix}/phones/validate | | Parameters | key, value | | Example | /v1/phones/validate?number=060550987&phone_code=33 | Strip Number| | | | :--- | :--- | | Method | POST | | Route | /{prefix}/phones/strip | | Parameters | key, value | | Example | /v1/phones/strip?number=060550987&phone_code=33 | Format Number| | | | :--- | :--- | | Method | POST | | Route | /{prefix}/phones/format | | Parameters | key, value | | Example | /v1/phones/format?number=060550987&phone_code=33 | Helpers
LocalizationThe available locales are ar, br, de, en, es, fr, ja, kr, pl, pt, ro, ru and zh. The default locale is en. Include in the request header
Schema<p><img src="./schema.jpg" width="600px"/></p> Countries database table fields
States database table fields
Cities database table fields
Timezones database table fields
Currencies database table fields
TestingRequirements - The database is seeded. - The database connection is defined in the .env file. Browse to the package root folder and run:
|