diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..a36db8a --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,23 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Build documentation with MkDocs +#mkdocs: +# configuration: mkdocs.yml + +# Optionally build your docs in additional formats such as PDF and ePub +formats: all + +# Optionally set the version of Python and requirements required to build your docs +python: + version: 3.7 + install: + - requirements: docs/requirements.txt diff --git a/README.md b/README.md index ae3b6ba..fa542b3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# DotArray - Sail through array using the dot notation +# PHP Dot-Array :: Sail through array using the dot notation

~ Enjoy your :coffee: ~

diff --git a/composer.json b/composer.json index 23331db..46eff2e 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { "name": "binary-cube/dot-array", - "description": "Navigate through array using JSON Dot notation path.", + "description": "PHP Dot-Array :: Sail through array using the dot notation", "keywords": [ - "DotArray", "dot-array", "array", "dot", "php-array", "php-array-json-path" + "DotArray", "dot-array", "array", "dot", "php-array", "php-array-json-path", "php" ], "type": "library", diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..fe09287 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,70 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'DotArray' +copyright = '2019, Banciu N. Cristian Mihai' + +# The full version, including alpha/beta/rc tags +release = '1.0' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinxcontrib.phpdomain' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + + +# -- Custom ------------------------------------------------- +import sphinx_rtd_theme +html_theme = "sphinx_rtd_theme" +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + +# Set up PHP syntax highlights +from sphinx.highlighting import lexers +from pygments.lexers.web import PhpLexer + +lexers["php"] = PhpLexer(startinline=True, linenos=1) +lexers["php-annotations"] = PhpLexer(startinline=True, linenos=1) +primary_domain = "php" + diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..662b240 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,62 @@ +.. title:: PHP DotArray Library:: Sail through array using the DOT notation + +==================== +DotArray +==================== + +.. raw:: html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+ +DotArray is a simple PHP Library that can access an array in a dotted manner. + +- Easy to use. +- Support to access complex keys that are having dot in the name. +- Fluent access. +- Possibility to search & filter items. +- Dot access can, also, works in the "old school" array way (Vanilla PHP). + +.. code-block:: php + + DotArray::create(['config' => ['some.dotted.key' => 'value']])->get('config.{some.dotted.key}') + +User Guide +========== + +.. toctree:: + :maxdepth: 2 + + overview + quickstart diff --git a/docs/overview.rst b/docs/overview.rst new file mode 100644 index 0000000..3915814 --- /dev/null +++ b/docs/overview.rst @@ -0,0 +1,108 @@ +======== +Overview +======== + +Requirements +============ + +#. PHP 7.1 + +.. _installation: + + +Installation +============ + +The recommended way to install DotArray is with +`Composer `_. Composer is a dependency management tool +for PHP that allows you to declare the dependencies your project needs and +installs them into your project. + +.. code-block:: bash + + # Install Composer + curl -sS https://getcomposer.org/installer | php + +You can add DotArray as a dependency using the composer.phar CLI: + +.. code-block:: bash + + php composer.phar require binary-cube/dot-array + +Alternatively, you can specify DotArray as a dependency in your project's +existing composer.json file: + +.. code-block:: js + + { + "require": { + "binary-cube/dot-array": "*" + } + } + +After installing, you need to require Composer's autoloader: + +.. code-block:: php + + require 'vendor/autoload.php'; + +You can find out more on how to install Composer, configure autoloading, and +other best-practices for defining dependencies at `getcomposer.org `_. + + +License +======= + +Licensed using the `MIT license `_. + + Copyright (c) 2018 Binary Cube + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + +Bugs and feature requests +========================= + +Have a bug or a feature request? +Please first read the issue guidelines and search for existing and closed issues. +If your problem or idea is not addressed yet, `please open a new issue `_. + + +Contributing +============ + +All contributions are more than welcomed. +Contributions may close an issue, fix a bug (reported or not reported), add new design blocks, +improve the existing code, add new feature, and so on. +In the interest of fostering an open and welcoming environment, +we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, +regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, +personal appearance, race, religion, or sexual identity and orientation. +`Read the full Code of Conduct `_. + + +Versioning +=========== + +Through the development of new versions, we're going use the `Semantic Versioning `_. + +Example: `1.0.0`. +- Major release: increment the first digit and reset middle and last digits to zero. Introduces major changes that might break backward compatibility. E.g. 2.0.0 +- Minor release: increment the middle digit and reset last digit to zero. It would fix bugs and also add new features without breaking backward compatibility. E.g. 1.1.0 +- Patch release: increment the third digit. It would fix bugs and keep backward compatibility. E.g. 1.0.1 diff --git a/docs/quickstart.rst b/docs/quickstart.rst new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/docs/quickstart.rst @@ -0,0 +1 @@ + diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..855d66c --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,3 @@ +Sphinx>=2.1.0 +sphinx_rtd_theme>=0.4.0 +sphinxcontrib-phpdomain>=0.6.1 diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 74d1ea3..f73483f 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -162,6 +162,7 @@ + @@ -229,9 +230,6 @@ - - -