99% of what the REST API does is a managed interface between the client and the database, and yet I can’t find any libraries that do just that for the rest of my life.
All libraries focus on providing a REST interface to the developer, who then establishes a connection to the database. It seems to me that I don’t need to create a library that already interacts with the database, and all that the developer needs is to define some ACL rules and connect some logic here or there.
So, before I continue and put my thoughts into action, actually creating such a library, can I just ask someone who knows about this subject; Has anyone implemented something like this? Will I reinvent the wheel?
I'm talking about PHP-based approaches, by the way, I have nothing against other languages, PHP is just my cup of tea. But in this regard, I did not find any implementations in other languages.
And in case my explanation does not make it very clear, this is essentially what I want:
<?php class post_controller extends controller { protected static $config = array( 'select' => true, 'insert' => true, 'update' => true, 'delete' => false, 'fields' => array( 'id' => array( 'select' => true, 'update' => false ), 'name' => array( 'select' => true, 'update' => true ), 'content' => array( 'select' => true, 'update' => true ) ) ); function put($data) { $data->content = htmlentities($data); return parent::put($data); } } ?>
Thanks in advance to anyone who provides their material and apologies if this is not the right question about Stackoverflow.
Edit:
To clarify, this type of service will be used for specific use cases, I do not think it is a type of thing that anyone can use for any type of web service.