Todo-Backend lists many implementations of the same REST API with different backend-oriented Web development frameworks.
I’ve proposed my own version using Symfony 4 in PHP, and the api-platform project which helps implementing REST APIs.
I’ve documented the way I did it in the project’s documentation in details, for those curious about Symfony development of a very simple REST API (JSON based). See its README file (of course redacted with the mandatory org-mode ;).
You can find the rest of the code here : https://gitlab.com/olberger/todobackend-symfony4.
AFAICS api-platform offers a great set of features for Linked-Data/REST development with Symfony in general. However, some tweaks were necessary to conform the TodoBackend specs, mainly because TodoBackend is JSON only and doesn’t support JSON-LD…
Oh, and the hardest part was deploying on Heroku, making sure that the CORS headers would work as expected :-/
During the course of Web architecture and applications, our students had to deliver a Silex / Symfony Web app project which I’m grading.
I had initially hacked a Docker container to be able to test that the course’s lab examples and code bases provided would be compatible with PHP 5 even though the nominal environment provided in the lab rooms was PHP 7. As I’m running a recent Debian distro with PHP 7 as the default PHP installation, being able to run PHP 5 in a container is quite handy for me. Yes, PHP 5 is dead, but some students might still have remaining installs of old Ubuntus where PHP5 was the norm. As the course was based on Symfony and Silex and these would run as well on PHP 5 or 7 (provided we configured the right stuff in the composer.json), this was supposed to be perfect.
I’ve used such a container a lot for preparing the labs and it served me well. Most of the time I’ve used it to start the PHP command line interpreter from the current dir to start the embedded Web server with “php -S”, which is the standard way to run programs in dev/tests environment with Silex or Symfony (yes, Symfony requires something like “php -S localthost:8000 -t web/” maybe).
I’ve later discovered an additional benefit of using such a container, when comes the time to grad the work that our students have submitted, and I need to test their code. Of course, it ensures that I may run it even if they used PHP5 and I rely on PHP 7 on my machine. But it also assures that I’m only at risk of trashing stuff in the current directory if sh*t happens. Of course, no student would dare deliver malicious PHP code trying to mess with my files… but better safe than sorry. If the contents of the container is trashed, I’m rather on the safe side.
Of course one may give a grade only by reading the students’ code and not testing, but that would be bad taste. And yes, there are probably ways to escape the container safety net in PHP… but I sould maybe not tempt the smartest students of mine in continuing on this path 😉
If you feel like testing the container, I’ve uploaded the necessary bits to a public repo : https://gitlab.com/olberger/local-php5-sqlite-debian.
Redland/librdf offers powerful features like being able to persist an RDF model to a relational database (only PostGreSQL seems to work on my setup with 1.0.16, but I may have misconfigured it). You can then do SPARQL queries over the model, and lots of other nice things.
Unfortunately, the default PHP bindings are not really object-oriented, so the code isn’t looking so good.
But thanks to a gentleman named David Shea, there is an object-oriented library named LibRDF (case is sensitive), that helps write nice looking PHP.
I discovered it via the blog post of Felix Ostrowski, who took over the maintenance of the LibRDF library (still the docs live on the original author’s site).
In his post, Felix illustrates how you may use it to parse Richard Cyganiak’s FOAF profile.
But the examples he gives don’t illustrate the full potential of persistence of the RDF graph into the DB.
Here’s my contribution in 2 examples that will hopefully help : first, one that load Richard’s FOAF to the DB, and one, that later retrieve the saved model and perform the same query (both pushed to my github clone of the library).
There may be some problems with the use of librdf, including its availability, as it is not full PHP of course… and I’ve heard of memory management problems, but, depening on your needs, this may be quite handy for writing Linked Data applications.
We’re working on implementing a demo/test server for the OSLC-CM V1 protocol, in order to help test client tools.
We’ve released (under a BSD license) a first 0.1 preliminary version that only supports GET queries, that’ll lead the way to an expected complete demo server of OSLC-CM V1 when the 1.0 version will be finished.
At the moment, it will only provide a minimal REST implementation of a PHP server using zend, and will produce JSON or XML/RDF views of fictionnal bugs contructed out of contents of a CSV file.
More details may be found at : https://picoforge.int-evry.fr/cgi-bin/twiki/view/Oslc/Web/, whereas the code is in the Download page there.