Download the PHP package opheus2/laravel-countries without Composer

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

Laravel Countries

Latest Version on Packagist Build Status Total Downloads

A Laravel package that provides comprehensive data for every country — codes, names, currencies, languages, capitals, regions, demonyms, translations, and more. Laravel 11+ supported.

What's New in v3.0.0

Install

Upgrading from v2.x

Replace deprecated method calls:

The deprecated methods still function but will emit E_USER_DEPRECATED warnings and will be removed in a future major release.

Usage

Lookup by Code

The getByCode() method auto-detects the code type:

Search by Name

Search by Language

Search by Capital

Search by Demonym

Search by Translation

Search by Currency

Filter by Region / Subregion

Filter by Independence Status

Get All Countries

Dropdown List Helper

Country Object

Currency Object

Eloquent Cast

Store country references in your database and cast them automatically:

Macros

The Country class implements Laravel's Macroable trait:

Mixins

Raw Data Access

Configuration

Publish the config file to customize the data source:

This creates config/laravel-countries.php where you can point to a custom JSON file:

Data Source

Country data is compiled from the REST Countries v3.1 JSON dataset using the included compile script (scripts/compile-data-source.php).

Differences from upstream REST Countries v3.1

Recompiling Data

To regenerate the data source from the latest upstream JSON:

API Reference

Method Returns Description
getByCode($code) Country\|null Lookup by cca2, cca3, ccn3, or cioc
getByName($name) array Partial match on common/official/native names
getByFullName($name) array Exact match on common or official name
getByLanguage($language) array Search by language code or name
getByCapital($capital) array Search by capital city (partial)
getByDemonym($demonym) array Search by demonym (exact, case-insensitive)
getByTranslation($translation) array Search any translation name (partial)
getByCurrency($currency) array Search by currency code or name
getByRegion($region) array Filter by region
getBySubregion($subregion) array Filter by subregion
getIndependent($status) array Filter by independence status
getAll($codes, $asCollection) array\|Collection Get all or filtered countries
getListForDropdown($key, $official, $locale) array Key-value pairs for dropdowns
getRawData() array Raw country data array

Deprecated Methods (v3.0.0)

Deprecated Method Replacement
getByAlpha2Code($code) getByCode($code)
getByAlpha3Code($code) getByCode($code)
getByNumericCode($code) getByCode($code)

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-countries with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^11.0|^12.0|^13.0
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 opheus2/laravel-countries contains the following files

Loading the files please wait ...