Stairtower

Stairtower is a (experimental) database server for schema-free, JSON documents, that provides a restful API and is entirely written in PHP.

What?

The server runtime is built on React and utilizes PHP's native JSON de- and encoding facilities to transform data. Where applicable the Standard PHP Library (SPL) is used to build on a solid foundation and increase performance.

Why?

The aim was to create a database system that is

portable

flexible

offers database seeding

does not require additional configuration

does not require additional software or languages

stores data in a human readable format

fits into the PHP environment

and is written in the language that we know and love

Additionally it should simply show that this is possible in the language that sometimes seems to be derided by followers of 'modern' programming languages.

Cons

While creating such applications one may hit the wall of PHP. Managing memory and fine tuning performance in PHP has its limitations. The control over memory usage, allocation and freeing in a long running PHP application is complicated, if not even impossible (please correct me). So the performance and efficiency of other document stores may be a lot better.

An attempt to memory management is done with the Memory Manager which holds the only reference to memory intense object's (especially Database instances) and allows them to be freed (calling unset() followed by gc_collect_cycles() ).

Pros

The whole system is written in a language that powers more than 80% of the web (http://w3techs.com/technologies/details/pl-php/all/all) and is used by some of the internet's biggest players. Writing the server in PHP opens the source code to be understood by a huge community and empowers them to adapt it to their needs. Furthermore parts of Stairtower may be reused in other projects (e.g. the server's backend could be used as data provider without using the REST interface).

Current State

The software is in alpha state an early alpha state and not ready for production. The biggest parts of the API are defined and major parts are covered by unit tests. Nevertheless there is much to improve.

Requirements

PHP 7.1 or higher

Roadmap

This section lists some planed features.

✓ Intelligent database writes

✓ MapReduce/Views to customize data aggregation (via PHP only)

✖ Simple application framework (under construction)

✖ Improved memory usage assumptions (before loading databases)

✖ Authentication (via Basic Auth and header)

✖ Request caching

✖ Update and delete collision prevention (like in CouchDB)

✖ Additional indexes and index types

✖ Implement a queue to schedule tasks (like database updates or reindexing)

Contribution

Feedback and contributions are more than welcome. This is a young project and I would like to let your great ideas shape the future of Stairtower. Please feel free to start chatting at https://gitter.im/cundd/pos or drop me a line at info@cundd.net.

License

The MIT License (MIT)

Copyright (c) 2017 Daniel Corn

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.