Package Data | |
---|---|
Maintainer Username: | rathesDot |
Maintainer Contact: | rathes@aheenam.com (Rathes Sachchithananthan) |
Package Create Date: | 2017-08-17 |
Package Last Update: | 2017-08-17 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:05:31 |
Package Statistics | |
---|---|
Total Downloads: | 24 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 2 |
Total Forks: | 0 |
Total Open Issues: | 0 |
This package is a Laravel Wrapper for the country-list package by Saša Stamenković. It was created as a fallback to antonioribeiro/countries which has PHP 7 and Laravel 5.3 as it minimum requirements.
Note: that this package does NOT contain the whole functionality as antonioribeiro/countries but only provides the name of the countries
You can install the package via composer:
$ composer require aheenam/laravel-translatable
Then add the service provider must be registered:
// config/app.php
'providers' => [
// ...
Aheenam\Countries\CountriesServiceProvider::class,
];
Also add Countries to your aliases list
// config/app.php
'aliases' => [
// ...
'Countries' => \Aheenam\Countries\Facades\Countries::class,
];
There are not that much methods for now. If you are interested in more, feel free to add them and send us a PR.
<?php
Countries::all();
returns a list of all countries in all languages currently loaded. By default the current language set in App::setLocale()
is populated.
If you want to get the countries in another language, use
<?php
App::setLocale('en'):
$countries = Countries::allIn();
$countries->get('en'); // returns a collection with all countries in English
To get a specific country call the get()
method with the language key, you are looking for
<?php
App::setLocale('en'):
Countries::get('de'); // returns "Germany"
If you want to get the language in a specific language, just add the language code as the second parameter.
<?php
App::setLocale('en'):
Countries::get('de', 'de'); // returns "Deutschland"
Check CHANGELOG for the changelog
To run tests use
$ composer test
or
$ composer test:windows
on windows machines.
soon
If you discover any security related issues, please email rathes@aheenam.com or use the issue tracker of GitHub.
Aheenam is a small company from NRW, Germany creating custom digital solutions. Visit our website to find out more about us.
The MIT License (MIT). Please see License File for more information.