Skip to content

Laravel 5 – Method injection

How method injection works in Laravel 5(I mean implementation), can I inject parameters in custom method, not just in controller actions? Answer 1) Read this articles to know more about method injection in laravel 5 http://mattstauffer.co/blog/laravel-5.0-method-injection https://laracasts.com/series/whats-ne…

WordPress cURL and wp_remote_post

So my problem is that i used until now in one of my wordpress plugins cURL for a POST request, but now i need to use wp_remote_post(). wp_remote_post seems simple but i can’t get it to work. So my …

Guzzle throws 401 or 406 exception

cURL works fine: curl -H “X-ApiToken: myapitoken” https://api.fulcrumapp.com/api/v2/records Guzzle does not: $client = new Client(); $request = $client->createRequest(‘GET’, “https://api….

Verify if curl is using TLS

In my PHP app I use PHP’s CURL and openssl, to connect and talk using SOAP. Until now, remote server supported SSL and TLS but because of “poodle” bug, admin decided to disable SSL and use TLS only. …

Tesseract exec not working

I have been trying to work this out for a couple days now and can’t crack it. I’m trying to use php to echo the result of tesseract. After everything I’ve researched and tried, I feel like the below code should work. The command runs fine via SSH and if I change the above to suit ifconfig it…

PHP Printf As Float Precision

I am attempting to use PHP’s printf function to print out a user’s storage capacity. The full formula looks something like this: Given that $size == (10 * 1024 * 1024), this should print out 10.00 GB But it doesn’t. It prints 10.04 GB. Furthermore, results in 10.04 What?! In giving it an int…

Laravel catch Eloquent “Unique” field error

I am trying to identify when inserting a record using eloquent in Laravel when it throws an exception because of a unique field error. The code I have so far is: try { $result = Emailreminder::…

Get the name of the user in yii2

How can I get the name of the logged-in-user in yii2? I can get the user-id with Yii::$app->user->id; and I know that I could find the name in the database but I want a direct way. The name-…