Jackdaw's Nest A Web Log

[ Log ] [ Projects ] [ About ]

Posts tagged with silex

# My First Package 2015/10/28

Wohoo! I just created my first Composer package. It's nothing fancy, just a simple Silex service provider for Tiny by Zack Kitzmiller.

You can find the package from Packagist and the code and more details in Github.

# File Upload in Silex 2015/10/19

For some reason I never remember how to save an uploaded file (or the contents of the file, to be specific) in Silex, my favourite Symfony2 based framework. Well, here it is. I hope I'll remember it if I write it down.

// Get the /Symfony\Component\HttpFoundation\File\UploadedFile
// 'file' is the name of the upload file field in the form.
$file = $request->files->get('file');

// Get the contents of the file. $file->getRealPath() returns
// the full path to the temporarily saved file.
$content = file_get_contents($file->getRealPath());

There is a move method in /Symfony\Component\HttpFoundation\File\UploadedFile but I rarely use it. I usually use Flysystem to abstract the filesystem away.

# Friday Afternoon 2015/10/16

Pretty productive week, I learned a lot about

Not bad at all.