“Image Optimizer API” is ready
“Get Notice 2017” contest is over
My project “Image Optimizer API” is ready. In last commit can you see how look new API controller and PHP Units test.
I use to test a library called Guzzle. With this library can I use “basic authentication” to join with my API:
$credentials = base64_encode('testname:testPassword'); $res = $client->post( 'http://imageoptimizerapi.dev/api', [ 'headers' => [ 'Authorization' => 'Basic ' . $credentials, ], 'http_errors' => false ] );
I can send the files too:
$imageFile = fopen(__DIR__ . '/test.png', 'r'); $res = $client->post( 'http://imageoptimizerapi.dev/api', [ 'headers' => [ 'Authorization' => 'Basic ' . $credentials, ], 'multipart' => [ [ 'name' => 'image', 'contents' => $imageFile ] ], 'http_errors' => false ] );
I will yet add file size limit and check monthly request limit. I want to join my project with Paypal too, but now is it not necessary.
“Slim Framework” was perfect to my project. If you want write easy web application or API, “Slim Framework” as small framework is a well choice.
“Get Notice 2017” contest is over. That was interesting experience. I will still publicate minimum one post a week.
No Comment