News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

OpenShift Blog:
Open Source Mapping with PHP and MongoDB
November 06, 2013 @ 13:47:38

On the OpenShift blog Ryan Jarvinen has a new tutorial showing you how to use MongoDB and Silex to create a basic mapping service. It takes advantage of the MongoDB spatial data and query functionality to help locate and map items from the dataset.

Whether your goals are civic-minded or otherwise, PHP can help you craft solutions that are every bit as simple and elegant as what you might expect to see from modern Python, Ruby, or JavaScript frameworks. This particular example is intended to serve as a reusable template for folks who are interested in producing their own mapping applications - substituting in their own collection of map points or other spatial data.

He starts with a look at the datastore - the MongoDB - and the kind of data it will contain. He's shared the dataset (and complete example code too) over on Github and includes the command to import it. He then starts in on the PHP side of things, showing you how to get Silex installed and add in some basic routes and CSS. He then uses the Leaflet.js library to import the data and drop it into an Openstreetmap-based map. The full code and data can be found in this repository over on Github.

0 comments voice your opinion now!
mapping mongodb leafletjs tutorial openstreetmap

Link: https://www.openshift.com/blogs/open-source-mapping-with-php-and-mongodb

PHPMaster.com:
Mapping with Geocoder PHP and Leaflet.js
November 06, 2013 @ 10:49:43

On PHPMaster.com a new tutorial has been posted showing how to combine Geocoder PHP with Leaflet.js to create interactive maps. The Leaflet.js library lets you easily create mobile-friendly maps with simplicity and usability in mind.

Interactive maps inside a web application have a lot of great uses. From visualizing data to highlighting points of interest, maps are expected to communicate ideas within the context of location easily. The hardest part, however, is converting that data into coordinates that the map can understand. Luckily, Geocoder PHP allows us to connect to different geo-coding providers. Combined with Leaflet.js, a simple Javascript library, creating maps is a breeze.

He starts by helping you get the Geocoder library installed via Composer and make a sample page (using Bootstrap and jQuery) with a container for the map. He helps you set up Geocoder with an adapter to connect to the service of your choice (like Google Maps, Bing Maps or Openstreatmap). With this configured and created, he inputs some sample data and coverts the addresses to latitude/longitude sets. He walks you through getting Leaflte.js added to the page and pulling in these results via individual generated Javascript variables. You can check out a demo of the end result to see how it all fits together too.

0 comments voice your opinion now!
mapping geocoder leafletjs tutorial introduction interactive

Link: http://www.sitepoint.com/mapping-geocoder-php-leaflet-js/

Gonzalo Ayuso:
Multiple inheritance with PHP and Traits
December 19, 2012 @ 13:17:48

Gonzalo Ayuso has a new post today showing how you can use traits in PHP to simulate a kind of multiple inheritance.

Multiple inheritance isn't allowed in PHP. [It's not] possible with PHP (in Java is not possible either), but today we can do something similar (is not the exactly the same) with Traits. Let me explain that: Instead of classes we can create Traits.

He includes a code example showing the creation of two traits, "Base1" and "Base2", that are implemented (via "use") and the calls to methods on each. He also points out the error condition and message that can come up when there's a conflict in the method names between two or more traits. This is relatively easy to solve with the mapping ability of the "use" statement (code example included for that too).

0 comments voice your opinion now!
multiple inheritance traits python example mapping use


Lee Davis' Blog:
FormFactory - Driving Doctrine 1.2 / 2.x Mappings into Zend_Form objects
March 30, 2012 @ 10:43:57

Lee Davis has a recent post to his blog showing how you can combine the Zend_Form component of the Zend Framework with Doctrine to help directly "drive" your forms.

On a few of my previous projects I found myself creating more form classes than I'd like. And after the 30th one I figured there had to be a better way. I quickly realised that most of the elements within these forms shared similarities to the data type I would use on my database definitions. As I was using Doctrine at the time I figured I could not only drive my database from my mapping definitions, but my forms too.

He shows how post gets into more detail about using the project (configuring caching, other config options).

The project can be found here on github.

0 comments voice your opinion now!
formfactory zendframework zendform project mapping


DevShed:
Building an ORM in PHP Domain Modeling
November 22, 2011 @ 16:46:10

Continuing on from the first part of their series, DevShed has posted part two of their "Building an ORM in PHP" series. This latest tutorial focuses on domain modeling (and collection handling).

In that first part, I implemented the ORM's data access and mapping layers. And as you'll surely recall, the entire implementation process was pretty straightforward and easy to follow. Of course, in its current state the ORM is still far from a fully-functional structure. We need to add some additional components to it, such as a domain model and the classes responsible for handling collections of entities (remember that the ORM relies heavily on the data mapper pattern to do its business properly).

He stays with his "simple blog" example and shows domain models (based on an abstract entity) for Entries, Comments and Authors. His containers extend the Countable, IteratorAggregate and ArrayAccess interfaces to give them some extra abilities.

0 comments voice your opinion now!
tutorial domain model orm database mapping relational


DZone.com:
The era of Object-Document Mapping
July 08, 2011 @ 11:45:46

On the PHP on Windows section of DZone.com today Giorgio Sironi has posted about a different sort of object mapping than is usually thought of with databases - object-document mapping.

The Data Mapper pattern is a mechanism for persistence where the application model and the data source have no dependencies between each other. [...] But everytime we talk about the Data Mapper pattern, we assume there is a relational database on the other side of the persistence boundary. We always save objects; we always map them to MySQL or Postgres tables; but it's not mandatory.

He talks about two projects, MongoDb_ODM and CouchDb_ODM, that the Doctrine project is working on to help make working with document-driven databases as simple as the usual ORMs. He includes a brief code snippet showing how the feature will work (hint: a namespace of Document instead of Entity). He lists some of the features - including the usual ORM capabilities, support for collections, cascade of persistence - and where you can get the latest code for it (from github and PEAR

0 comments voice your opinion now!
object document mapping doctrine mongodb couchdb


Otto on WordPress:
WordPress 3.0 Multisite Domain Mapping Tutorial
June 18, 2010 @ 11:07:19

From the Otto on WordPress blog there's a recent post (made more useful by the release of WordPress 3) about how to use the multi-site abilities of this latest version to create multiple sites with their own domain names attached to each.

The other day, Klint Finley wrote a very good walkthrough of using the new Multisite functionality of WordPress 3.0. In the comments, a lot of people wanted to know how to use your own Top-Level-Domains. Since I'm doing that now, here's a quick walkthrough/how-to guide.

He uses the WordPress MU Domain Mapping plugin to get the job done and, via screenshots and a little bit of code, shows you how to use the admin panel to easily set up the domains and the sites they should resolve to.

1 comment voice your opinion now!
wordpress domain mapping admin plugin multiuser


Derick Rethans' Blog:
PHP and Ordnance Survey Mapping
April 28, 2010 @ 10:55:14

Derick Rethans, indulging his "map geek" side, has written up a new post showing how he took the data from Ordnance Survey and mapped some information in the UK - postcode density for the whole area.

I decided to map all the postcodes onto the UK map where more postcodes for a specific place would create a "lighter" colour. Each postcode has on average about 15 addresses, so in more densely populated areas you have more "postcodes-per-area". Doing this wasn't very difficult and it resulted in the following map.

He walks through the entire process including how, in working with the data, he noticed alignment issues caused by the differing projections the map information service uses (Mercator) versus just mapping to a flat image. Some calculations were made to convert the latitude/longitude to the correct locations and the resulting points were plotted on a cut-out image of the UK.

After I figured out all the maths for this, the only problem that remains that implementing those algorithms in PHP is show-calculating all the positions from the 1.6 million postcode locations takes up to 10 minutes. This is why I am not presenting any code yet. I am planning to implement all the necessary calculations in a PHP extension to speed up the calculations.
0 comments voice your opinion now!
ordnance survey mapping uk postcode


DevShed:
Using Code Igniter to Build an IP-to-Country Mapping Application
February 25, 2009 @ 07:57:11

DevShed finished off their tutorial series looking at mapping IPs to countries in a CodeIgniter application with this new article completing the application to provide a correct products list based on their location.

In this final chapter of the series, I'll be discussing how to build multi-lingual web pages by combining the functionality brought by the "iptocountry" MySQL table that you learned in previous tutorials and the power of the Code Igniter PHP framework.

Their database tables sort the prodcuts out with the three character country code they're associated with. The IP-to-country tables then help with the translation between the visitor's IP address and which products should be shown.

0 comments voice your opinion now!
country ip mapping products codeigniter framework


DevShed:
Generating Web Pages in Multiple Languages with a PHP IP-to-Country Mapping Application
February 19, 2009 @ 12:03:18

DevShed has the next in their "IP to country" series posted today, this new tutorial showing how to create a more customized site (a simple page or two) with the IP detection and a front controller.

Welcome to the third part of a series on developing an IP-to-country mapping application with PHP. Made up of four approachable tutorials, this series teaches you how to create a program like this by using a single MySQL lookup table, and shows you how to use this program to enrich your own web sites with geo-location capabilities.

They use the mapping data you pulled from the Webnet77 ip-to-country database (and dropped into the MySQL database) to evaluate where the user is coming from and display product information based on the two letter country code it returns. They throw in a bit about a front controller too, a simpler way to ensure that the user's location code is set for every request.

0 comments voice your opinion now!
mapping application front controller mysql database tutorial



Community Events





Don't see your event here?
Let us know!


developer list community interview deployment framework laravel bugfix series language zendserver podcast library threedevsandamaybe release introduction opinion tips symfony api

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework