The State Decoded Documentation

Config file

Configuration Options


What is the title of the website?


What is the name of the place that these laws govern?


What does this place call its laws? e.g., The Kansas Statutes, The Code of Virginia, etc.


What is the prefix that indicates a section? In many states, this is §, but in others it might be s . This would be formatted as § 1.23-45 or s. 123.


The path to the contents of the website, e.g. the location of index.php.


The directory in which the importer can find the laws to be imported.


The file in the /includes/ directory that contains functions custom to this installation. By convention, this is named for the place that these laws govern, e.g.


The directory in which themes (site design templates) are found.


The name of the theme that’s in use.


The filesystem path to the directory that contains the theme. This defaults to TEMPATE_DIR/THEME_NAME (e.g., /var/www/


The public URL of the directory that contains the theme (e.g.,


Define the default version of the API to send requests to, if a version isn’t othewise specified.


Establish which version of the code that’s in effect sitewide. This is the database ID in the editions table. (On a new installation, this will always be 1.)


Establish which version of the code that’s in effect sitewide. This is the label for the present revision. Although the word “year” appears in the title, if setting up a site for a code that is updated more frequently than annually, another terse label will suffice here (e.g., 2015-02-01 or 2014-Q1). This label will appear in URLs.


Does this state’s code include laws that have been repealed formally, and that are marked as such? This will suppress their display, so that visits don’t have to wade through empty, repealed laws. If your legal code isn’t full of vast wastelands of long-abandoned chapters, then you can leave this set to FALSE.


Should we use short URLs or long URLs for laws? Short URLs are the default (e.g.,, but if laws have non-unique identifiers, then you’ll need to use long URLs (e.g., which are URLs that incorporate the hierarchical structures (e.g., laws, titles, parts, etc.) that contain each law.


PHP Data Object’s Data Source Name—tells PHP how to connect to the MySQL database. (Only MySQL will work.) This looks like this:


dbname is the name of the database that you created for The State Decoded. host is the name of the database server. This will most often be localhost—check with your host for details, if that doesn’t work. And charset must always be utf8.


The database username.


The database password.


Specify the structural identifier ancestry for the unit of the code that contains definitions of terms that are used throughout the code, and thus should have a global scope. Separate each identifier with a comma. If all global definitions are found in Title 15A, Part BD, Chapter 16.2, that would be identified as 15A,BD,16.2. If all global definitions are found in Article 36, Section 105, that would be identified as 36,105. This must be the complete path to the container for global definitions, and not a standard citation.

Not all legal codes need this. This only needs to be specified for those legal codes that list globally applicable definitions but that don’t specify within the list of definitions that they are globally applicable. For instance, a legal code might set aside a chapter to list all global definitions, and use the first law in the chapter to say “all following laws apply globally,” and then have 100 more laws, each containing a single definition. This is a legal code for which this configuration option is necessary.


Create a list of the hiearchy of the code, from the top container to the name of an individual law. A legal code’s top structural unit might be “titles,” and each title might be divided into “chapters,” each chapter might be divided into “parts,” and each part might be divided into “sections.” That would be rendered here as title,chapter,part,section.


Define the regular expression that identifies section references. It is best to do so without using the legal code’s symbol (e.g., §), since section references are frequently made without its presence. A growing collection of per-state regular expressions is available—even if the regular expression that you need isn’t found there, you should be able to find something to repurpose.


The path, relative to the webroot, to an error page to be displayed if the database connection is not available. (Like the fail whale.) Do not begin this path with a slash. If this is undefined, a bare database connection error will be displayed.


When there is cause for the website to send an e-mail (e.g., API registration), what “From” address should be used?


When sending e-mail, what name should appear in the “From” field?


Record each view of each law in the laws_views table? Doing so provides a corpus of data that can be useful for analysis, data that will be drawn on in future releases of The State Decoded, but that at present is not used for anything. This is done via MySQL’s INSERT DELAYED, so it will not slow down page rendering time, but it does require a certain amount of system resources and storage.


When embedding definitions for legal terms, should the terms in The State Decoded’s built-in legal dictionary be included? If this is set to FALSE, only the terms defined within this legal code will appear as defined terms. The built-in legal dictionary includes definitions for nearly 500 legal terms that are not generally defined within legal codes. If any of the terms are defined within this legal code, the generic definition will not be displayed, in favor of the legal code’s custom definition.


This indicates whether the data is indexed with Solr or MySQL and, if Solr, specifies how to interact with Solr. Unusually for these configuration options, the value of this is a JSON-encoded array (JSON-encoded because constants cannot contain arrays). Only the engine element is necessary if using MySQL, otherwise all additional listed array elements must be completed as specified within the config file.


The site uses its own API extensively, such as to display inline definitions and inline cross-references. That API is stored here, although you don’t have to do it—this is populated automatically at the time that the parser is run.


If you want to enable Disqus commenting for every law, register for Disqus, create a new site, and enter the assigned Disqus shortname here.


If you’re running a Varnish server, and you want The State Decoded to automatically purge expired content, provide the URL (including the port number) here.


If you want to track traffic stats with Google Analytics, provide your site’s web property ID here.


The State Decoded can optionally render the site using several very nice, commercial fonts, calling them from Adobe’s Typekit service. This requires paid registration at the “Portfolio” level, which costs $4/month. The provided Typekit site ID goes here. See the “Typekit typefaces” section of the installation guide for details about where to find that ID.



If you are running APC on your web server, note that all of these configuration constants are cached aggressively. You will need to clear APC’s cache after making any changes to them, or else those changes will not take effect for hours or days. This can be done in your site’s admin section. (Note that the option is only displayed if you are running APC.)

Edit this on GitHub