PHP helper functions – checking if string is ending or starting with a subscring

Something very basic but really useful when not using a framework ūüôā You will already find it defined in Laravel 5.5 as starts_with() / ends_with() https://laravel.com/docs/5.5/helpers#method-starts-with

 

Composer killed while updating

I was running a small Digital Ocean server (512 MB RAM) for a side project and got to the problem that I could not use composer update after pushing changes related to the use of new packages. Fortunately, I got into this that saved the day. I am sharing it, maybe it will save yours. … 

 

PHP convert CSV to associative arrays

<?php $csv = array_map(‘str_getcsv’, file($file)); array_walk($csv, function(&$a) use ($csv) { $a = array_combine($csv[0], $a); }); array_shift($csv); # remove column header ?> This will yield something like this – keys are the fields/ table header of the CSV file. [2] => Array ( [Campaign ID] => 295095038 [Ad group ID] => 22460178158 [Keyword ID] => 3993587178 … 

 

Helpful CURL usage examples

Some nice advice and tutorials, well explained about using CURL found on gist.github.com/subfuzion/08c5d85437d5d4f00e58

 

Started learning NodeJS

I’ve been into PHP programming for 10 years now. I decided to start learning NodeJS for a side project that I am rewriting and got from¬†https://github.com/sergtitov/NodeJS-Learning¬†to this interesting comparison¬†between PHP and NodeJS from¬†https://webapplog.com/php-vs-node-js/ Another comparison I have found is from SitePoint¬†https://www.sitepoint.com/sitepoint-smackdown-php-vs-node-js/ The GitHub repo above has a lot of interesting tutorials and starting points, a … 

 

Clean Code Concepts Adapted for PHP

Clean Code PHP (jupeter/clean-code-php), is a guide based on the book Clean Code: A Handbook of Agile Software Craftmanship, a classic programming book about writing maintainable code by Uncle Bob Martin. Learn more about it from this Laravel News post

 

Yii – bypassing beforeSave()

If you have defined in your model some “actions” / “mutators” in your,¬†beforeSave method there is a simple way to prevent that these actions to take place in certain cases when you need that. For example,¬†having a Company model and a field, ¬†unpaid_invoices_count¬†that¬†you are updating during each saving. If you want that in a certain …