Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Us States Laravel Package

awcodes/us-states

awcodes/us-states is a small Laravel package that bundles United States state data for your applications. Use it to populate select fields, validate state input, and reference state names and abbreviations without hardcoding lists in your codebase. Simple helpers keep state options consistent across...

View on GitHub
Deep Wiki
Context7

Get US states by all or query by code, name or slug.

Frequently asked questions about Us States
What is awcodes/us-states used for in Laravel?
awcodes/us-states is a small Laravel package that bundles United States state data for your application. It lets you retrieve all states or look up a state by code, name, or slug, which helps you avoid hardcoding state lists. Common uses include select fields, validation rules, and consistent state references in APIs.
How do I install awcodes/us-states?
Install the package with Composer by running composer require awcodes/us-states. After installation, check the README for any required setup, though data-only packages often work without migrations or service provider changes. Commit your composer.json and composer.lock changes so the dependency is reproducible.
Do I need to configure or publish anything for awcodes/us-states?
Because the package bundles static state data, it is intended to work without database tables or external services. Review the README for optional configuration or publishable files, but many small data packages require no setup beyond Composer installation. Only publish configuration if the package documents a setting you actually need to change.
How do I get all US states with awcodes/us-states?
Use the package's all-states retrieval feature to get the complete list of US states. The README documents the exact method name and return format, so you can map the results into select options or an API response. This keeps your state list centralized instead of duplicating it across your codebase.
How do I query a state by code, name, or slug?
The package supports looking up state data by code, name, or slug, so you can resolve a single state without filtering the full list yourself. Check the README for exact method signatures and what happens when no match is found. This is useful for route slugs, form submissions, and API lookups by abbreviation.
Does awcodes/us-states work with Laravel validation?
You can use the package's state codes or names to build Laravel validation rules and keep submitted input consistent. For example, derive an in rule from the package data or wrap the lookup in a custom rule. Confirm the exact data shape in the README before wiring it into validation.
Which Laravel versions does awcodes/us-states support?
The package's composer.json and README are the source of truth for supported Laravel and PHP versions. As a small data-only package it is likely compatible with current Laravel releases, but verify before upgrading your application. If you are on an older Laravel version, check the package constraints before requiring it.
Is awcodes/us-states safe for production?
Yes, awcodes/us-states is a lightweight package that ships static state data, so it avoids external API calls and database dependencies. Review the repository's release history and Composer constraints to confirm it fits your production stack. Because state data changes rarely, ongoing maintenance should be minimal.
How do I test code that uses awcodes/us-states?
Because the package returns static data, your tests can assert that form options, lookups, or validation rules include the expected state codes and names. No external service or database is required, so tests run quickly and deterministically. If you wrap the package in your own service, test that wrapper rather than the package internals.
Are there alternatives to awcodes/us-states for US state data?
Alternatives include maintaining your own state array, using a broader geographic data package, or relying on another package that provides US state lists. awcodes/us-states is a focused choice when you only need US states and want to avoid hardcoded arrays. Compare package maintenance, Laravel version support, and data shape before choosing.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource