PHPackages                             digital-canvas/options - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. digital-canvas/options

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

digital-canvas/options
======================

Used to create lists of countries and states.

1.0.2(9y ago)0869MITPHP

Since May 22Pushed 9y ago2 watchersCompare

[ Source](https://github.com/digital-canvas/options)[ Packagist](https://packagist.org/packages/digital-canvas/options)[ RSS](/packages/digital-canvas-options/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

States Options
==============

[](#states-options)

[![Latest Stable Version](https://camo.githubusercontent.com/37860e21b8913a5004df421c6ab145101f7f873b3ab8a6a22bf12d885a2eecb6/68747470733a2f2f706f7365722e707567782e6f72672f6469676974616c2d63616e7661732f6f7074696f6e732f762f737461626c65)](https://packagist.org/packages/digital-canvas/options)[![Total Downloads](https://camo.githubusercontent.com/315121c583d6f75104fa83b5c28ae4896aa44adf8bab3014e1e1c5e203a4eb9f/68747470733a2f2f706f7365722e707567782e6f72672f6469676974616c2d63616e7661732f6f7074696f6e732f646f776e6c6f616473)](https://packagist.org/packages/digital-canvas/options)[![License](https://camo.githubusercontent.com/3184b2f2b7e6103e29ab492d5c5d9410e53cdfba8379322427deb13354adc13d/68747470733a2f2f706f7365722e707567782e6f72672f6469676974616c2d63616e7661732f6f7074696f6e732f6c6963656e7365)](https://packagist.org/packages/digital-canvas/options)[![Build Status](https://camo.githubusercontent.com/50bb9e01252c5754ad71a843f03b65d51f9ac8ccb979faa96e7b0219a47b446c/68747470733a2f2f7472617669732d63692e6f72672f6469676974616c2d63616e7661732f6f7074696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/digital-canvas/options)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ca2c2efa371ec7a8e908d0edfb0a313137f5ec3f92998cc871690e4c88e2d833/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6469676974616c2d63616e7661732f6f7074696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/digital-canvas/options/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/daac8d55da63054a882f5ee994957cc18a49d26cf2aff9f8e352359d02c2489e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6469676974616c2d63616e7661732f6f7074696f6e732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/digital-canvas/options/?branch=master)[![Build Status](https://camo.githubusercontent.com/8827358d847db8c56c2ca0d5dcd3e2999f22811df9f1ea6c6b40d33d6c4a94e7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6469676974616c2d63616e7661732f6f7074696f6e732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/digital-canvas/options/build-status/master)[![SensioLabsInsight](https://camo.githubusercontent.com/7807aa350e10c9811b109590f98b5ee01619be2e9a51b160b0a9b8cd0c0af291/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f32383431363966332d663434612d346231352d393832382d6239656236376333373065322f6d696e692e706e67)](https://insight.sensiolabs.com/projects/284169f3-f44a-4b15-9828-b9eb67c370e2)

Used to create lists of countries and US and CA states/provinces.

Installation
------------

[](#installation)

```
composer require digital-canvas/options

```

Usage
-----

[](#usage)

### Create an array with state abbreviations as keys and full names as values

[](#create-an-array-with-state-abbreviations-as-keys-and-full-names-as-values)

```
// US states only
$states = \DigitalCanvas\Options\States::getPairs(['US']);
// US states and CA provinces
$states = \DigitalCanvas\Options\States::getPairs(['US', 'CA']);

```

### Create an array with abbreviations as keys and full array of state data as values

[](#create-an-array-with-abbreviations-as-keys-and-full-array-of-state-data-as-values)

```
// US states only
$states = \DigitalCanvas\Options\States::getArray(['US']);
// US states and CA provinces
$states = \DigitalCanvas\Options\States::getArray(['US', 'CA']);

```

### Create a `` list for state selection

[](#create-a-select-list-for-state-selection)

```
