Skip to content

Instantly share code, notes, and snippets.

@hgraca

hgraca/Resource.php

Last active Aug 22, 2018
Embed
What would you like to do?
RMR - Resource-Method-Representation pattern
<?php
// taken from http://www.peej.co.uk/articles/rmr-architecture.html
class Resource {
private resourceData = [];
method constructor(request, dataSource) {
// load data from data source
}
method get(request) {
return new Response(200, getRepresentation(request.url, resourceData));
}
method put(request) {
return new Response(405);
}
method post(request) {
return new Response(405);
}
method delete(request) {
return new Response(405);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment