Browsing projects by Tag(s)

Select a tag to browse associated projects and drill deeper into the tag cloud.

Showing page 1 of 1

A PHP Library to easily create clean URI's

5.0
 
  0 reviews  |  2 users  |  43 lines of code  |  2 current contributors  |  Analyzed over 3 years ago
 
 

uri_grammar provides a Spirit grammar for parsing URIs. The grammar is parameterized with user-supplied parse actions.

0
 
  0 reviews  |  1 user  |  492 lines of code  |  0 current contributors  |  Analyzed 9 days ago
 
 

A Java URI Template processor implementing RFC6570 featuring a fluent API, level 4 templates, and Java objects as template values.

0
 
  0 reviews  |  1 user  |  2,783 lines of code  |  5 current contributors  |  Analyzed 4 days ago
 
 

uriparser is a strictly RFC 3986 compliant URI parsing library written in C. uriparser is cross-platform, fast, supports Unicode and is licensed under the New BSD license.

0
 
  0 reviews  |  0 users  |  16,616 lines of code  |  1 current contributor  |  Analyzed 3 days ago
 
 

OverviewSimpleUrlMapper for PHP provide generic functionality for URL mapping and routing based on a simple implementation of URI Templates. SimpleUrlMapper allows you to define variables to be parsed out of URLs that match URI Templates with those variables, i.e. "post_id" and ... [More] "posts/{post_id}" where "post_id" would potentially represent a blog post ID and "posts/3" would indicate a blog post ID of 3. UsageNote the callback functions specified for template and validations receive an associative array containing the value(s) of matched template variables from the URL. Assuming the URI template is: foos/{foo}/bars/{bar}/bazes/{baz} and for a matching URL: foos/1/bars/test/bazes/3 the variable passed to the callback function would have the following values (shown using a PHP express that would generate the value): array('foo' => 1, 'bar' => 'test', 'baz' => 3); NOTES:URI Template should not include a leading slash. URI Template syntax based on URI Templates although it does not support full URI template syntax, it currently only supports named variables. ExampleThe following is taken from the test file packaged with the simpleurlmapper.php and was taken from working code for a WordPress image cropper plugin. $path = (isset($_GET['path']) ? $_GET['path'] : 'images/123/crops/4/edit'); require_once('simpleurlmapper.php'); $url_mapper = new SimpleUrlMapper(); $url_mapper->add_variable('image_id', array( 'decription' => 'Positive integer matching a valid ID for an existing image in the media library.', 'type' => 'integer', 'validator' => 'validate_image_id', )); $url_mapper->add_variable('crop_no', array( 'decription' => 'Positive integer 1..{n} where {n} is the maximum number of predefined crop sizes required.', 'type' => 'integer', 'validator' => array(1,5), )); $url_mapper->add_variable('post_id', array( 'decription' => 'Positive integer matching a valid ID for an existing post.', 'type' => 'integer', 'validator' => 'validate_post_id', )); $url_mapper->add_template('edit', array( 'template' => 'images/{image_id}/crops/{crop_no}/edit', 'action' => 'do_edit_crop', )); $url_mapper->add_template('review', array( 'template' => 'images/{image_id}/crops/review', 'action' => 'do_review_crops', )); $url_mapper->add_template('crop', array( 'template' => 'images/{image_id}/crops/{crop_no}', 'action' => 'do_crop', )); $url_mapper->add_template('associate', array( 'template' => 'images/{image_id}/posts/{post_id}', 'action' => 'do_set_post_association', )); $url_mapper->execute($path); function do_edit_crop($data) { extract($data); print "Do Edit Crop #$crop_no for Image ID $image_id\r\n "; return; } /* do_review_crops($data) */ function do_review_crops($data) { extract($data); print 'Do Review Crops'; return; } /* do_crop($data) */ function do_crop($data) { extract($data); print 'Do Crop'; return; } /* do_set_post_association($data) */ function do_set_post_association($data) { extract($data); print 'Do Set Association'; return; } /* validate_image_id() */ function validate_image_id($value,$data) { print "Validate Image ID $value\r\n "; return true; } /* validate_post_id() */ function validate_post_id($value,$data) { print "Validate Post ID $value\r\n "; return true; }HistoryI developed SimpleUrlMapper because I needed to create a set of RESTful services for use inside another framework, in this case WordPress. I build an image cropping plugin for WordPress and that plugin uses SimpleUrlMapper. I decided to release it as open-source in case others could benefit from it and in hopes I might find others willing to help me improve it. Future?I may or may not continue to improve SimpleUrlMapper, it all depends on where my project work takes me. I'm currently an independent consultant so if you would like to use it but need it modified to support your own specific use-cases such as improving performance when a large number of templates are used or to improve URI template support to cover more use-cases, contact me and we can discuss. [Less]

0
 
  0 reviews  |  0 users  |  255 lines of code  |  0 current contributors  |  Analyzed 2 days ago
 
 

php uri routing library

0
 
  0 reviews  |  0 users  |  816 lines of code  |  1 current contributor  |  Analyzed 26 days ago
 
 
 
 

Creative Commons License Copyright © 2013 Black Duck Software, Inc. and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a Creative Commons Attribution 3.0 Unported License . Ohloh ® and the Ohloh logo are trademarks of Black Duck Software, Inc. in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.