|
1 |
| -<p align="center"> |
2 |
| - <img src="https://github.com/lwwcas/laravel-countries/blob/master/assets/map.jpg" /> |
| 1 | +<p align="center"> |
| 2 | +<img src="https://raw.githubusercontent.com/lwwcas/laravel-countries/master/assets/map.jpg" /> |
3 | 3 | </p>
|
4 | 4 |
|
5 |
| -# Very short description of the package |
6 |
| - |
7 | 5 | [](https://packagist.org/packages/lwwcas/laravel-countries)
|
8 |
| -[](https://travis-ci.org/lwwcas/laravel-countries) |
9 |
| -[](https://scrutinizer-ci.com/g/lwwcas/laravel-countries) |
| 6 | + |
10 | 7 | [](https://packagist.org/packages/lwwcas/laravel-countries)
|
11 | 8 |
|
| 9 | +# Very short description of the package |
| 10 | + |
| 11 | +Laravel-Countries, is a package that contains everything you need to start a new project and have all countries, information and translations on hand. |
| 12 | +**And all this optimized for Laravel 8.** |
| 13 | + |
| 14 | +The package provides all data directly to your database, allowing you to link to any other table in your database, in a simple and usual way. |
| 15 | + |
| 16 | +<p align="center"> |
| 17 | +<img src="https://raw.githubusercontent.com/lwwcas/laravel-countries/master/assets/EER-countries.png" /> |
| 18 | +</p> |
| 19 | + |
| 20 | +### Geology and topology maps |
| 21 | + |
| 22 | +Amongst many other information you'll be able to plot country maps: |
| 23 | + |
| 24 | +<p align="center"> |
| 25 | +<img src="https://raw.githubusercontent.com/lwwcas/laravel-countries/master/assets/brazil-map.png" /> |
| 26 | +</p> |
| 27 | + |
| 28 | +### Available Languages? |
| 29 | +| Language | |
| 30 | +------------------| |
| 31 | +| English | |
| 32 | +| Portuguese | |
| 33 | +| Spanish | |
| 34 | +| Italian | |
| 35 | + |
| 36 | + |
| 37 | + |
12 | 38 | ## Requirements
|
13 |
| -- [PHP](https://github.com/php) >=^7.3|^8.0 |
14 |
| -- [laravel/framework](https://github.com/laravel/framework) >=^8.12 |
15 |
| -- [dimsav/laravel-translatable](https://github.com/Astrotomic/laravel-translatable) >=^11.8 |
| 39 | + |
| 40 | +- [PHP](https://github.com/php) >= ^7.3 | ^8.0 |
| 41 | + |
| 42 | +- [laravel/framework](https://github.com/laravel/framework) >= ^8.12 |
| 43 | + |
| 44 | +- [dimsav/laravel-translatable](https://github.com/Astrotomic/laravel-translatable) >= ^11.8 |
| 45 | + |
| 46 | + |
16 | 47 |
|
17 | 48 | ## Installation
|
18 | 49 |
|
| 50 | + |
| 51 | + |
19 | 52 | You can install the package via composer:
|
20 | 53 |
|
| 54 | + |
| 55 | + |
21 | 56 | ```bash
|
| 57 | + |
22 | 58 | composer require lwwcas/laravel-countries
|
| 59 | + |
23 | 60 | composer dump-autoload
|
| 61 | + |
24 | 62 | ```
|
25 | 63 |
|
| 64 | + |
| 65 | + |
26 | 66 | - Put this line into database\seeds\DatabaseSeeder.php in run function
|
| 67 | + |
27 | 68 | ```php
|
| 69 | + |
28 | 70 | $this->call(\Lwwcas\LaravelCountries\Database\Seeders\LcDatabaseSeeder::class);
|
| 71 | + |
29 | 72 | ```
|
30 | 73 |
|
| 74 | + |
| 75 | + |
31 | 76 | - Run migrations
|
| 77 | + |
32 | 78 | ```bash
|
| 79 | + |
33 | 80 | php artisan migrate
|
| 81 | + |
34 | 82 | ```
|
| 83 | + |
35 | 84 | - Run seeds or only the LcDatabaseSeeder class
|
| 85 | + |
36 | 86 | ```bash
|
| 87 | + |
37 | 88 | php artisan db:seed
|
| 89 | + |
38 | 90 | ```
|
39 | 91 |
|
| 92 | + |
40 | 93 | ## Usage
|
| 94 | + You can access all the information in the database with a simple query |
| 95 | + |
| 96 | +``` php |
| 97 | +use Lwwcas\LaravelCountries\Models\Country; |
| 98 | + |
| 99 | +Country::whereIso('BR')->first(); |
| 100 | +Country::whereIsoAlpha3('BRA')->first(); |
| 101 | +Country::whereSlug('brasil')->first(); |
| 102 | +``` |
| 103 | + |
| 104 | +<p align="center"> |
| 105 | +<img src="https://raw.githubusercontent.com/lwwcas/laravel-countries/master/assets/country-model.png" /> |
| 106 | +</p> |
41 | 107 |
|
42 |
| -``` php |
43 |
| -// Usage description here |
| 108 | +## Take a good look at the Model and see the package makes it easy |
| 109 | + |
| 110 | +[Country](https://github.com/lwwcas/laravel-countries/blob/master/src/models/Country.php) |
| 111 | +[CountryTranslation](https://github.com/lwwcas/laravel-countries/blob/master/src/models/CountryTranslation.php) |
| 112 | +[CountryRegion](https://github.com/lwwcas/laravel-countries/blob/master/src/models/CountryRegion.php) |
| 113 | +[CountryRegionTranslation](https://github.com/lwwcas/laravel-countries/blob/master/src/models/CountryRegionTranslation.php) |
| 114 | +[CountryGeographical](https://github.com/lwwcas/laravel-countries/blob/master/src/models/CountryGeographical.php) |
| 115 | + |
| 116 | + |
| 117 | +### Example data |
| 118 | + |
| 119 | +``` json |
| 120 | + |
| 121 | +{ |
| 122 | + "id": 30, |
| 123 | + "lc_region_id": 2, |
| 124 | + "uuid": "343d2082-f6fb-42e6-ac7a-f78dad39de31", |
| 125 | + "slug": "brazil", |
| 126 | + "name": "Brazil", |
| 127 | + "official_name": "Federative Republic of Brazil", |
| 128 | + "iso_alpha_2": "BR", |
| 129 | + "iso_alpha_3": "BRA", |
| 130 | + "iso_numeric": 76, |
| 131 | + "geoname_id": "3469034", |
| 132 | + "international_phone": "55", |
| 133 | + "languages": "[pt]", |
| 134 | + "tld": "[.br]", |
| 135 | + "wmo": "BZ", |
| 136 | + "emoji": { |
| 137 | + "img": "🇧🇷", |
| 138 | + "uCode": "U+1F1E7 U+1F1F7" |
| 139 | + }, |
| 140 | + "color_hex": [ |
| 141 | + "#008000", |
| 142 | + "#ffff00" |
| 143 | + ], |
| 144 | + "color_rgb": [ |
| 145 | + "0,128,0", |
| 146 | + "255,255,0" |
| 147 | + ], |
| 148 | + "coordinates": { |
| 149 | + "latitude": { |
| 150 | + "classic": "10 00 S", |
| 151 | + "desc": "-10.81045150756836" |
| 152 | + }, |
| 153 | + "longitude": { |
| 154 | + "classic": "55 00 W", |
| 155 | + "desc": "-52.97311782836914" |
| 156 | + } |
| 157 | + }, |
| 158 | + "coordinates_limit": { |
| 159 | + "latitude": { |
| 160 | + "max": "5.266667", |
| 161 | + "min": "-33.733333" |
| 162 | + }, |
| 163 | + "longitude": { |
| 164 | + "max": "-28.85", |
| 165 | + "min": "-73.75" |
| 166 | + } |
| 167 | + }, |
| 168 | + "visible": true, |
| 169 | + "translations": [ |
| 170 | + { |
| 171 | + "id": 30, |
| 172 | + "lc_country_id": 30, |
| 173 | + "name": "Brazil", |
| 174 | + "slug": "brazil", |
| 175 | + "locale": "en" |
| 176 | + } |
| 177 | + ] |
| 178 | +} |
44 | 179 | ```
|
45 | 180 |
|
| 181 | + |
| 182 | + |
46 | 183 | ### Testing
|
47 | 184 |
|
48 |
| -``` bash |
| 185 | + |
| 186 | + |
| 187 | +``` bash |
| 188 | + |
49 | 189 | composer test
|
| 190 | + |
50 | 191 | ```
|
51 | 192 |
|
| 193 | + |
| 194 | + |
52 | 195 | ### Changelog
|
53 | 196 |
|
| 197 | + |
| 198 | + |
54 | 199 | Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
|
55 | 200 |
|
| 201 | + |
| 202 | + |
56 | 203 | ## Contributing
|
57 | 204 |
|
| 205 | + |
| 206 | + |
58 | 207 | Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
|
59 | 208 |
|
| 209 | + |
| 210 | + |
60 | 211 | ### Security
|
61 | 212 |
|
| 213 | + |
| 214 | + |
62 | 215 | If you discover any security related issues, please email [email protected] instead of using the issue tracker.
|
63 | 216 |
|
| 217 | + |
| 218 | + |
64 | 219 | ## Credits
|
65 | 220 |
|
| 221 | + |
| 222 | + |
66 | 223 | - [Lucas Duarte](https://github.com/lwwcas)
|
| 224 | + |
67 | 225 | - [All Contributors](../../contributors)
|
68 | 226 |
|
| 227 | + |
| 228 | + |
69 | 229 | ## License
|
70 | 230 |
|
| 231 | + |
| 232 | + |
71 | 233 | The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
0 commit comments