I came across this cool little PHP function testing tool website today at http://php.fnlist.com/array/array_count_values
It claims to have over 200 PHP functions to test online.
Each functions has a page which has input fields for each function parameter. You can then enter a string, array, date, or whatever is ask for and it will pass those input field values into the PHP function and show the result on the page.
It's a useful little tool for testing how certain functions work on different sets of data, etc...
I am building a Web Developer Toolbox app which takes all my most used and favorite web dev apps and tools and combines them into 1 single app. Each tool in my app is going to be a "plugin" so that users can add/disable/create there own dev tools as needed in the app.
So I am wanting to have a plugin tool in my app with similar functionality as this website to allow the testing of PHP functions.
Does any open source projects exist that do this task already that anyone knows of? Otherwise I am asking how to go about building such a tool.
For example if a function parameter expects an array to be passed in. How can I ensure that the text input POSTed has a valid array or string or Date or whatever it is asking for?
Also any other related info that might be useful to build such a tool is appreciated
I found a solution here https://github.com/Corveda/PHPSandbox
Demo of it: https://code.phpsandbox.org/
GitHub project: https://github.com/Corveda/PHPSandbox
Docs: https://manual.phpsandbox.org/2.0/
Related
I am trying to build a web application that would display Twitter feed based on multiple hashtags in real time. Something like TweeterWall. I've been Googling around, but there are so many APIs that I am a bit confused.
My setup is a standard shared hosting with PHP and MySQL.
My question: Which method is best suited for my environment?
Should I use Streaming API, Search API, Sockets, maybe Javascript with setInterval()..
i realy ont know..
Thanks for your answers.
- Cheers
Take a look at this project on GitHub. Don't be confused by the title - it has been updated since Twitter's API update to 1.1.
The jQuery plugin on the page has been re-purposed to be a Rendering engine, i.e. it helps with rendering your feeds.
The important part, however is in the "Server-Side Examples and Setup" directory. Go there, read the SETUP_INSTRUCTIONS document, and use the code in the "Plug_and_Play/Ready_PHP.php" file as your starting point.
If you followed the instructions in the SETUP_INSTRUCTIONS document, you should only have to copy and paste the keys from Twitter into the file, along with a Twitter handle, and it should render the timeline for you.
Note that you will have to update the code to render multiple timelines, and will have to either use AJAX or some other solution for updating the timelines, to simulate real-time.
On that note, be careful not to blow the rate-cap. If you are rendering timelines for just two Twitter handles, you can update them only once every 6 seconds (best case scenario). To do this, you will have to use a separate web service to perform the requests and then query that service from your webpage.
P.S. I am the author of that project, so if you need any help, let me know. Good luck! :)
I'm developing an iPhone APP and need to implement also an Web Service.
First of all I'm not a Developer and never made something big in PHP, Objective-C, xCode.
My PHP knowledge isn't also good. But let's start with my Environment.
iPhone APP (xCode 4.2, iOS5), PHP Web Service, MySQL DB
I was researching the WEB and most People tend more to REST than SOAP. I think i see also the advantages of REST (using of simple HTTP Verbs (get, post, delete etc...), but that's not the main point here...
I think I understand the main goal of the REST Architecture and tried to make a little concept with an URI and Verb Mapping. Here just a simple example of the mapping:
/location/{location_id}/product
/location/{location_id}/product/{product_id}
Both are GET operations who should get me ether a single product or all products of a location.
How would a simple PHP REST Web Server look like with these functions?
Another part should implement a User Authentication from the iPhone. Somehow i need to store the user session, right now I don't have any idea how to make that. The goald is that if only a user is logged in, he could review the product.
Now I've researched also the Web but couldn't find an easy step-by-step Tutorial.
Do you know any good Tutorials which will help me achieve my goal? :)
A lot of people prefer using PHP Frameworks like ZEND. This seems very interesting, but it seems like a big package with a lot of modules.
Does someone know exactly which Modules are needed to get my Web Service working?
This is quite a good tutorial, it uses the codeigniter framework which makes the learning curve a bit steeper but makes it a lot more powerful in the long run.
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
If you want to build this the custom way it's actually very easy to do if you want to return information in the JSON format especially for php5 which is generally well supported amongst hosts these days.
Essentially the steps are like this:
Pass in product id via url and retrieve using GET i.e. service.php?product_id=10
Query database and return data for product id that was passed in
Store returned data in an array
Set header content-type to application/json
json_encode the result (json_encode)
That way when you call that url in a browser you will get a nice JSON formatted array result in a key:value pair manner. And as of iOS5 json parser comes with the framework (for earlier versions SBJson is a good framework to use (SB JSON))
Recently I've read a number of articles talking about the idea of using "feature toggles" or "gatekeepers" to keep features hidden from users until the development is done. Facebook and Flickr both also talk about how they use this to test new features with a subset of users before unleashing them on everyone.
A bit of googling didn't turn up any existing PHP packages/tools that can be added to a web app to handle this type of thing. It seems straight forward enough to roll our own but no reason to re-invent that wheel if we don't need to. Are there any existing PHP tools to do this?
Articles
Feature Toggle by Martin Fowler
Flipping Out on Flickr DevBlog
Clarification: The part of this that I'm looking to see if it exists is the admin panel that controls which users can see the new features. In Flickr's example, they can turn it on based on the host. In the Facebook example, they add functionality such as limiting a feature to 5% of users, only TechCrunch users or only East coast users.
The admin panel seems crucial when you have 200 turned on features, 10 features that aren't quite done yet and 3 more that you're demoing for some users.
if (user_can_see_app()) {
show_app();
} else {
dont_show_app();
}
I fail to see why a package would be required for something so simple.
I've wrote a micro service for feature toggle pattern, called Bipolar:
https://marinho.github.io/bipolar-server
It is written in Python but that doesn't matter because it is an external API and Admin interface, so, all you need is to write a PHP client for it. We have used it in production for a while but only worked on public release and documentation recently. For JavaScript support it can push notifications using Webhooks as a basic URL call or via Pusher event.
I am bit missed after many years with no contact with PHP, but I can help you to write the client if you are interested.
I hope that can be helpful.
The easiest solution i found is to have the feature toggle state stored in some remote location that can change easily (turn it on/off)
I found it easy to have on GitHub a repo holding some JSON data with the feature toggle's state, later on you can change that state on GitHub (from phone/pc etc...)
your php code needs to fetch the JSON and make a decision from it ...
you can look at the blog post about how to achieve this:
http://www.nimrodstech.com/dead-simple-feature-toggle/
it shows a code snippet of how to achieve this in a simple way.
I would like to add a feature to a web app I am developing to allow the user to create rules with an expression builder. Such as the one used in Magento (picture in link below).
http://i.stack.imgur.com/ZWgcG.png
I want to allows them to be able to create the expressions or if statements using column names from a table in a Database, then be able to do comparisons and what not. The expression built in the user interface would then evaluate to code that would be evaluated by a PHP script or Javascript or Perl
I searched the web for things like this that are javascript (ajax) based. I figures there has to be a module or something out on the internet somewhere for jQuery or something similar, but I haven't been able to find anything. I am also not quite sure what something like this is called besides "Expression Builder". If there is something like this out there it would save me a lot of time compared to writing it from scratch.
In Mac OS X terms it is called a “predicate editor”, and can be found in Mail.app and iTunes. I had need for one a while ago, and scoured the web from end to end without finding one. I ended up building my own using jQuery, and it looks like this (text is in norwegian, sorry):
Sadly this is used in an internal project and the source code is not available as it is very application-specific. There is a need for a free component like this though, so if I get around to it I will try to clean this up and release it.
This here should be exactly what you're looking for?
Demo: https://github.com/chrisjpowers/business-rules
Code: https://github.com/chrisjpowers/business-rules
https://packagist.org/packages/ruler/ruler
https://github.com/bobthecow/Ruler
This is very similar to magento one and we are going to use it in our laravel application.more guidance for implementation you can find there.
This fits the bill: (jquery) predicate-builder
No mainstream tool out there for PHP... except the ones we make for ourselves :)...Its easy to implement a decent one... Just need to decide where you will store the rules... I had built one for myself with the Rule definition stored in XML ... Then updated it a few months back to store that in JSON .... You write "smarty like" templates for the output you want... 2 cases where I used this was for an Active Record implementation as well as PDF generation ... the move to JSON was because most of the newer usage scenarios were related to throwing out javascript for the pages to consume...
I'd like to query a MySQL database via a RESTful service with the middleware being PHP. I'd like the output to be JSON. I'm a beginner in those areas. Are there any frameworks or scripts that can do this without requiring you to be an expert? I don't have a problem stringing a few scripts together if they can work.
Or, if it can be done much simpler without using REST (i.e. query parameters), that's fine.
In the end, I want to have an iPhone app fetch this data and have it returned via JSON. No javascript will be involved.
You can convert a MySQL result set to JSON easily: http://phpclasses.nlared.com/browse/package/3195.html
For a RESTful interface, basically any hosted PHP script can function as a REST interface for your application.
Check out this project: http://phprestsql.sourceforge.net/
On this site you will find a RESTful
interface (written in PHP) to a
database (a MySQL database, but that's
not important). Below you will find a
interactive tutorial that will get you
accessing, adding and deleting rows
from our database via our Javascript
powered REST browser.
The PHP shouldn't necessarily be your middleware in your situation, you'll have to build your "RESTful" service somehow, whether it be with PHP or any other language. You don't have to be an expert, but I think CakePHP has some of these capabilities.
Maybe explain in more detail what you want to do.
Update
Try this out:
http://techno-geeks.org/2009/08/easy-json-with-cakephp-and-jquery/
Not only is CakePHP easy to install and use, it's also easy to extend.