Mundus Meus 0.1.0
Description
Mundus Meus allows you to plot the locations of entities. It then allows the end user to specify their location (with optional auto-detection), and it then maps places of interest close to them.
In the example we're using Tescos. If you specify your location, the application will notify you of Tescos within close proximity to you.
The REALLY good thing about Mundus Meus is that it's written for developers to extend! It's written in beautiful OOP – PHP5 and AngularJS, and therefore is crying out to be extended in any way a developer sees fit. However, for those wanting to get started quickly, all you need to do is clone the example and style as necessary.
API
Mundus Meus defines two API routes:
api/Geolocate/Nottingham
– Discovers the latitude/longitude for Nottingham;api/Search/52.95385025/-1.1698803748747/10
– Searches for entities around the lat/long – optional radius in miles.
Please note: the aforementioned routes require MOD_REWRITE
to be enabled – AllowOverride
also needs to be set to All
in order for the routes to resolve correctly.
Technologies
- Angular.js: Utilised for the front-end example and API;
- Nominatim API: For resolving places to latitude/longitude values;
- PHP Router: Laravel inspired PHP router;
- LESS: Preprocessor for more organised stylesheets;
- Leaflet.js: For all of the mapping functionality;
- Grunt.js: Build process for the JavaScript/LESS/HTML;
Getting Started
Installing Mundus Meus' dependencies requires npm – running npm install
will install all dependencies as taken from the package.json
file.
If you wish to create a build yourself then you'll need to install Grunt.js – you can create a build by issuing the grunt
command.
Adding a Service
As you're probably not wanting to map Tescos stores, Mundus Meus allows you to add your very own services very easily. Please follow the step-by-step guide:
- Create a new service class in
api/Service
– call itService_Halfords
; - Change the
$_map
property to map the properties from the API toname
,latitude
,longitude
, et cetera...; - Modify the
API_URL
constant to the Halfords store location URL (database interface coming shortly); - Implement the
_parseData
hook which allows you to parse the idiosyncratic response from the API; - Open
Default.php
and change thegetService
method to the name (without prefix) of your new service –Halfords
;
Mundus Meus uses the template method pattern and therefore if you're overwriting methods from the abstract and then calling super
, you're doing something wrong.
Etymology
You're probably wondering, so we'll spill the beans! Mundus Meus is Latin for My World. We considered calling it Meus Mundus Parvus (My Little World), but frankly, that's a little too long for comfort.