PHP Reddit – Telegram
PHP Reddit
34 subscribers
289 photos
37 videos
24.8K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Commands and Jobs

Hi everyone,

Imagine the scenario:

User has a button that will perform a heavy lifting task. My approach ? Create a Job for this.

This task will also have a schedule command because needs to run everyday for each client that we have. Business logic for this task is on a service. Should i call on the command the service function or dispatch the job?

Thanks

https://redd.it/1ntp6ap
@r_php
A new PHP Job Board

# I launched a new PHP Job Board for high quality PHP Jobs. Recruiters and Developers do consider joining. First 100 verified recruiters get to post a job for free!

https://redd.it/1nu7yow
@r_php
Where can I find a collection of custom built PHP functions?

I know PHP alone has so many built-in functions, but I wonder if there are free custom built-in PHP functions for any web app to use.
When I do search on Google I have found only for WordPress.

Eg, in my web app the below code is used to truncate a long string and add ....
function cutString($cutString, $numberToCut){

if(mb_strlen($cutString, 'UTF-8') > $numberToCut){ // If the String has more than X characters then show ...

return mb_substr($cutString, 0, $numberToCut, 'UTF-8').'...';

}else{

return $cutString;

}

}

This has been used in whole web app as a string truncator in to what exactly I want from.

And here another custom built-in function from my web app:
function getDomain($url) {

$host = parse_url($url, PHP_URL_HOST);

if ($host) {

// length validation + expanded TLD patterns

preg_match('/([a-z0-9\-]{1,63}\.(?:[a-z]{2,63}|[a-z]{2}\.[a-z]{2}|[a-z]{3}\.[a-z]{2}))$/i', $host, $matches);

return $matches[1] ?? $host;

}else{

return null;

}

}

Is there a collection or repository of custom-built PHP functions for anyone to use?

Also, nowadays, are custom-built functions like the above still valuable to others? If I share mine on GitHub, would it help? Sometimes it feels like I'm one of the few developers still messing with custom PHP codes.

https://redd.it/1nuav7x
@r_php
Share Your Laravel Story: Be Featured as Artisan of the Day!
https://redd.it/1nuft56
@r_php
Is it possible to find a job or an internship that's not paid as a junior PHP dev?

Hello everyone, Im 20 years old and I am in that stage where I dont know if i should pursue something, in my case being a web dev. I have a few projects, a PHP Hospital Management System, a local platform for agriculture companies in MCV and OOP PHP, a webshop in Node and a group project carpooling app in Node as well and im planning on doing more real world applications, apps that in theory could solve real world problems. During these four years, I did a lot of WordPress work, which inlcuded redesigning themes, incorporating plugins, css and JS corrections, tranlsating pages etc. Some languages i have extensive knowledge in are PHP, JavaScript, Node, Java, Express, SQL and a bit ot C#. So i was wondering if its possible to find an unpaid internship or perhaps a lower paid job, as im not aiming to get a six figure job. Any advice on what to do, what to focus on or where to find an internship or a job in Europe or US remote? Thank you in advance.

https://redd.it/1nuewpr
@r_php
Anyone has a working example of google ads API in php to share?

I'm trying to get it to work with the google ads library but it keeps installing older versions and I'm lost, the authentication is a pain in the ass also. Anyone care to share a working version of it if you have it?

https://redd.it/1nuk7lf
@r_php
How I stopped wasting time hunting requests in Telescope with a tag

Hey everyone, small milestone: I published my first Laravel package.

I built it because I was wasting time trying to correlate API responses with Telescope entries. Often I'd see a bad client log and then spend 10-15 minutes hunting the same request in Telescope. So I made something to stop that.

What it does: it automatically appends a request id to JSON responses, sets the propagation header and attaches a tag in the telescope request with the request id, out of the box, no controller changes.

Why I made it: I wanted something tiny, zero-fuss, and configurable. I've started using it in my project and it already cuts down my "where did this error come from?" time by simply searching by the request id tag in telescope.

It's called Telescope Request Track, link on Packagist & GitHub below. If you try it, I'd love feedback (tiny fixes, feature requests, or even a ⭐️).

Packagist: https://packagist.org/packages/bekand/telescope-request-track
GitHub: https://github.com/anduen-beqiri/telescope-request-track

Hope that it helps somebody with debugging :)

https://redd.it/1nv29il
@r_php
I created a static site generator with php (no framework)

Hi everyone, I'm looking for some feedback on this project, I intend to use it as part of my startup webdev agency statisch.co, I've made the repository free and opensource and will continue to improve upon it to make it easier and more fun to work with. The reason I built my own static site generator instead of using the 100's of others out there is so I can fully understand every single line of code I deploy on behalf of my customers. I thought about keeping this private but then I just thought "why?" I had so much help from opensource in my career and if this helps anyone else better understand static site generation it's worth making public, so here you go. It's not perfect but it works... I would love to hear any criticisms or suggestions for improvement.

https://github.com/Taujor/php-static-site-generator

https://redd.it/1nv704v
@r_php