Download the PHP package woodsandwalker/laravel-countries without Composer

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

Packagist Downloads Packagist Version

Laravel Countries is a bundle for Laravel providing ISO 3166_2 codes for all countries along with a country model, cast and validation rule.

Getting Stated

Installation

Configuration

There is minimal config and the package can be used without any configuration. The only configuration option is an array of countries to exclude. This works by applying a global scope on the Country model.

To publish the configuration you can run this command:

To exclude a country simply add its ISO code to the exclude array:

Model

The package contains a calebporzio/sushi model which contains the iso_code and name for each country. Using this type of model also means there is no database migration required.

This model can be used like any other Laravel model.

Validation Rule

The package contains a validation rule which validates the ISO code.

You can override the default validation error message using the validation.country key in your lang files.

Model Attribute Cast

The package contains a model attribute cast. The cast expects the ISO code as the original attribute.

You can use the following migration to add a country column to the users table.

Then add the cast to the user model:

Store a country against a user:

You can now access the ISO code and the name on the country attribute on the user model:

Localization

When accessing a country name the model will look for a translation string of countries.{ISO_CODE}, for example, countries.GB. If this translation string cannot be found it will fallback to the en locale.

Installing New Locales

A command is included with the package to install new country locales from umpirsky/country-list. You can view all the available locales here. This command will create a new file in lang/{locale}/countries.php. This command uses the file_get_contents function which requires allow_url_fopen to be on in your PHP config.

To install a new locale, for example Spanish (es), run the command:

License

Laravel Countries is released under the MIT License. See the bundled LICENSE.md file for details.


All versions of laravel-countries with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1|^8.2|^8.3
illuminate/database Version ^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
calebporzio/sushi Version ^2.5
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 woodsandwalker/laravel-countries contains the following files

Loading the files please wait ....