I recently had to code a REST call to a service I could only access behind a SOCK5 proxy. Unfortunately, the hostname of the service wasn’t publicly resolvable so the DNS had to be resolved on the other side of the proxy. Whilst this is pobbible in cURL itself by using the CURLOPT_PROXYTYPE option and setting it to CURLPROXY_SOCKS5_HOSTNAME or by using the flag –socks5-hostname – the constant isn’t available within PHP. This feature was requested in https://bugs.php.net/bug.php?id=65469 however hasn’t yet been implemented. This can simply be worked around by setting the proxy type to 7. The code below shows an example of doing this using the Httpful library, however if you were using curl natively you’d just use curl_setopt()
$r = HttpfulRequest::post($url)
I am finally starting to dive into symfony 2 properly. Yes – it’s taken a while, work has taken me in different directions! I found myself needing to create a custom form field type pretty quickly, but couldn’t find much in the way of documentation to do so, so I thought I’ld throw it up here; partly to help others, but mostly to get feedback to make sure I’m not approaching this from the wrong angle.
Continue reading “Creating a custom form field type in symfony 2”
VERP (http://en.wikipedia.org/wiki/Variable_envelope_return_path) provides a method for handling bounced emails. This is especially useful when it comes to figuring out which emails failed to get delivered from your application/mail outs. This post covers how I got this working in symfony using swiftmailer to send the mail, and exim to deliver bounces back into symfony. The concepts shown can be applied to just about any combination of software though.
Continue reading “Using VERP with swiftmailer, symfony and exim”
When a file is uploaded using sfForm in the admin generator, by default the filename that’s used is a random string, which can look bad in URLs. If you want to change this, it’s not immediately obvious how – but it is incredibly simple.
Continue reading “Handling Uploaded file in symfony's admin generator”
I needed to create a date/time widget for use in an sfForm in a symfony project I was working on, and unfortunately there’s not currently a widget that I could find to allow this. In this post I show how I solved this problem, creating a widget for selecting a date range, using the jquery date selector from sfFormExtraPlugin.
Continue reading “Date/Time Range Selector Widget for Symfony”
I recently needed to send the result of an action in symfony via email daily. E-mail has changed slightly in symfony 1.3/1.4 – here’s how I did it. I really don’t like my solution at all, the use of get_partial() from within a Task seems very wrong to me – but I’m in a rush so it will do for now, I’d love to hear feedback
Continue reading “Sending multipart email from a Task in symfony 1.4”
Workflows are a useful tool to help manage business processes. In this post I take a look at the workflow engine of eZ components, which was developed by Sebastian Bergmann. In this post, I introduce the basics of the workflow engine, and will expand on it’s usage in future posts.
Continue reading “PHP workflows – ezComponents”
Fabien has already introduced the symfony service container, and will be shortly releasing a post covering more of it. I was keen to get my hands dirty, so I’ve dived into the code and got a quick example working.
Continue reading “sfServiceDefinition – a brief introduction”
In a recent post about Symfony components – Fabien wrote about how the Symfony project (yes, that’s right – a capital S now!) will be releasing more and more components. In this post I introduce sfYaml, a YAML parser for PHP – building on my previous blog post about routing.
Continue reading “YAML in PHP – fun with sfYaml”
symfony 1.2 was quite an improvement over 1.0, one of the most important changes was improved decoupling between components. In this article we’re going to put this to the test and have some fun with sfRouting.
Continue reading “Playing with symfony routing – without symfony”