commit ac2255d24d7dd39ac91fa50d3a7aa71ce0a92188 Author: flashwave Date: Tue Sep 13 15:13:11 2022 +0200 Imported into new repository. diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b6d2ecb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +* text=auto +*.sh text eol=lf +*.php text eol=lf +*.bat text eol=crlf +VERSION text eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8a26c2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +[Tt]humbs.db +[Dd]esktop.ini +.DS_Store +.vscode/ +.vs/ +.idea/ +docs/html/ +.phpdoc* +.phpunit* diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..691d03b --- /dev/null +++ b/LICENCE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2021-2022, flashwave +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d7a5162 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# Index + +Index is a common library for my PHP projects. + +It provides a number of components that I would otherwise copy between projects (and thus become out-of-sync) as well as a number of quality of life things on top of standard PHP stdlib functionality such as abstractions of arrays and strings as objects inspired by .NET's standard library. + + +## Requirements and Dependencies + +Index currently targets **PHP 8.1**. (also list extensions!!!!!!!!!) + +### `Index\Data\MariaDB` + +Requires the `mysqli` extension. `mysqlnd` is recommended as the underlying driver, but `libmysql` should work without a hitch. This driver also works for MySQL as the dependencies would suggest, but you should consider using MariaDB instead of possible. + +### `Index\Data\SQLite` + +Requires the `sqlite3` extension. + + +## Versioning + +Index versioning will mostly follow the [Semantic Versioning specification v2.0.0](https://semver.org/spec/v2.0.0.html), counting dropped support for a minor PHP version (e.g. 7.1 -> 7.2 or 7.4 -> 8.0) as a reason to increment the major version. +Previous major versions may be supported for a time with backports depending on what projects of mine still target older versions of PHP. + +The version is stored in the root of the repository in a file called `VERSION` and can be read out within Index using `Index\Environment::getIndexVersion()`. + + +## Contribution + +By submitting code for inclusion in the main Index source tree you agree to transfer ownership of the code to the project owner. +The contributor will still be attributed for the contributed code, unless they ask for this attribution to be removed. +This is to avoid intellectual property rights traps and drama that could lead to blackmail situations. +If you do not agree with these terms, you are free to fork off. + + +## Licencing + +Index is available under the BSD 2-Clause License, a full version of which is enclosed in the LICENCE file. diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..8d8ffca --- /dev/null +++ b/TODO.md @@ -0,0 +1,37 @@ +# TODO + +## High Prio + + - Create tests for everything testable. + + - Draw out a plan for the templating backend. + - Will probably just construct using the HTML abstraction stuff, would make AJAX'ing page updates trivial also. + - Reinvestigate the semi-isolated PHP script template system I used in some other project, I forgot which. + + - Determine structure for markup parsing abstraction. + - Writing a bbcode and markdown parser outside of Index, will implement a structure when done. + + - Create HTML construction utilities. + + - Create similarly address GD2/Imagick wrappers. + + - Review CSRF code, Something about it has me constantly wondering if its too Complex. + + - Figure out the SQL Query builder. + - Might make sense to just have a predicate builder and selector builder. + + - Create a URL formatter. + + - Add RSS/Atom feed construction utilities. + + - Probably get rid of StringBuilder, PHP strings aren't entirely immutable so that whole issue doesn't even exist. + I have a number of possible fixes in my head for this. The primary reason for A/W/IString was to have a consistent API between + normal strings and mbstrings. I'm not sure yet but part of me wants to keep IString but move a lot of functionality into XString and make that the go-to. WString could remain, maybe in a reduced form? Having the encoding of the string associated with it is very convenient. + +## Low Prio + + - Get guides working on phpdoc. + + - Create phpdoc template. + + - Review all constructors and see which one should be marked @internal. diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..f8dfde8 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.2202.281831 diff --git a/bench/_init.php b/bench/_init.php new file mode 100644 index 0000000..630940d --- /dev/null +++ b/bench/_init.php @@ -0,0 +1,17 @@ + 0) + $body(); + + $sw->stop(); + + printf('Took: %Fms %s', $sw->getElapsedTime(), PHP_EOL); + + echo PHP_EOL; +} diff --git a/bench/example.php b/bench/example.php new file mode 100644 index 0000000..360d84e --- /dev/null +++ b/bench/example.php @@ -0,0 +1,7 @@ + + + Index Documentation +