Code examples

PHP-7+ generator delegation example

PHP-7+ generator delegation example

This example demonstrates Php generators and generator delegation. PHP generators allow us to use foreach constructs to iterate over sets of data without constructing an array when we want to return data. This eliminates possible exceeding memory limit problems due to constructing large arrays that consume a lot of memory.

Remove multiple occurrences Php algorithm-1

Remove multiple occurrences Php algorithm-1

Simple Php algorithm combining array functions and a foreach loop to remove multiple value occurrences in the original array.

Symfony-5 + Bootstrap-5 task list example web application

Symfony-5 + Bootstrap-5 task list example web application

This is a Symfony-5 PHP framework boilerplate CRUD web application git repository that demonstrates basic Symfony MVC design pattern and things like Twig template engine, Doctrine ORM, etc. In time I will add more functionality, like different user roles, and users, that can read, update or delete tasks. Additional stuff will be added as I go along and this is going to become a real world full-featured web app.

Vue.js regex form validation

Vue.js regex form validation

This is a Vue.js form validation with a little help from regular expressions. The important part here is to pay attention to preventDefault method in combination with the errors array or success message array after the submit event has been triggered. Regular expressions are the only waterproof tool to sanitize the inputs although the browser and the HTML itself can be used for this purpose if you do not want to spend some time on analysing and writing down the regex yourself.

Laravel 8 API example with Sanctum authentication

Laravel 8 API example with Sanctum authentication

I have created a fresh Laravel project and a products API with all the routes defined, and on top of that I have installed a Sanctum package used for authenticating privileged users and protected routes with a default token system that comes packaged in with Sanctum. I will probably be building a frontend component with Vue.js or jQuery on top of this API to show the objects that can be CRUD-ed via the API routes. You can test this API with a tool like Postman (this is what I use) or something similar, to check the consistency of HTTP request-response actions for each route.

L-tasks - Laravel 8 and Tailwind css app

L-tasks - Laravel 8 and Tailwind css app

I have created this Laravel 8 and Tailwind css project that demonstrates CRUD system built with well known Laravel functionality like out of the box middleware, fake data generated with Laravel tinker and factories, blade templating, etc. Feel free to download, comment or use this starter task list web application in your own projects or code workouts. Online full-featured demo will soon be available also.