PHP Reddit – Telegram
PHP Reddit
34 subscribers
293 photos
37 videos
24.9K links
Channel to sync with /r/PHP /r/Laravel /r/Symfony. Powered by awesome @r_channels and @reddit2telegram
Download Telegram
Is there a tool for visualization?

Does anyone know if there's a website for visualization for PHP that shows the process what's happening when your run a block of code?

https://redd.it/1jaarqd
@r_php
Statamic CMS as rest-api endpoint for big data

Hi guys, I'd need to create a ecommerce rest-api and looking for a ready to use cms..
Anyone ever used statmic as a rest-api based cms? Any feedbacks?

I know there are some lacks of functionalities, like in-built auth or different collections for different tables, can it be a good idea as a rest-api (with around million records) ?



https://redd.it/1jaaf6h
@r_php
Ideal ai/symfony/ide setup for "old newbie"?

Hey guys I haven't done any web development for a long time but was a fairly decent self-taught web dev a few years ago.

I use claude a lot for my work and am wondering if I can use claude and microsoft code studio to help me build out some new symfony projects and maybe dust off and upgrade some old ones.

So my question is what utilities/tools do you use to connect claude (or the ai of your choice) to Symfony and your favorite code editor and also what is your ai of choice?



https://redd.it/1jaqaxh
@r_php
I can now easily search all 420 GB of PHP source code in Packagist.org. What do you want to search for?

Limitations:

I can search by first letter of the vendor, the entire thing.
The cut-off date is the last time my Bettergist Collector did the full analysis of all reachable composer packages, which is done quarterly. Currently: 2024-12-31.
It's running on the dedicated server locally, and takes about 5 minutes per query.
The results will be dumped into a search log, such as this one: https://www.bettergist.dev/searches/povils.phpmnd-search.log
If you give me plaintext to exclude, I can do that, too. (in the above search, everything in a directory called `phpmnd` was excluded).
The max size of a search result is currently hard-coded to 5 MB.

Only file names will be shown if you want.

I got really really excited when I dev'd this today and I wanted to share with you. Search 420 GB of pure PHP code in less than 5 minutes. How cool is that?!

The tech does have the ability to do regex searches. You'd need to make sure it's compatible with grep on the CLI. Regex seems to take 30 minutes.

https://redd.it/1japt28
@r_php
PHPoker: The PHP Extension

Not trying to spam everyone! But...

There were a few (very valid) comments on my original PHPoker post(s) last week that discussed performance concerns.

PHP is not necessarily the most optimal choice when running a Monte Carlo simulation for millions of iterations. There are existing libraries for Rust/C++ which perform orders of magnitude better. What PHP does have, is the ability to integrate with C at a very low level - which led me to give this project a shot.

https://github.com/PHPoker/Extension

This is a PHP extension which implements the original implementation of Kevin "CactusKev" Suffecool's algorithm - as native PHP functions backed by C. It creates two new native PHP functions `poker_evaluate_hand()` and `poker_calculate_equity()`.

Being my first attempt at a PHP extension, I am sure there are a ton of things which can be done better. Ex. I am sure my equity calculation implementation is a little naive, and my C code probably looks amateurish.

With that being said, the performance improvements are already drastic! The standard PHP implementation was taking > 60s to run a few million simulations, this is already < 2s. I will do some proper benchmarking this weekend.

After the benchmarking, I want to improve the test suite, and do some exploration related to integrating the extension with the original library. Ex. have the PHPoker library use these native functions if available, and having the new native function use some of the enums/classes/types from the library, etc.

If you are a little adventurous and like poker, check out the ReadMe and run the build noscript. I would love any feedback, questions, comments, thanks for reading!



https://redd.it/1jawpjy
@r_php
Livewire/blade Nvim setup

Currently work mainly with Laravel+inertia+react but want to have a play with livewire. Does anyone have any good plugin/config repo suggestions for neovim (specifically for blade w livewire components)

https://redd.it/1jaz5mx
@r_php
🚀 Laravel 12 + React API Token Management – Watch This! 🔑

Hey Devs! If you're using Laravel 12 with the React Starterkit and need a simple way to handle API token management, you’ll want to check out this video! 🎥

I walk you through Keysmith React, a package I built to make API key generation, management, and permissions super easy with Laravel Sanctum and React components.

# 🔎 What You’ll Learn:

Installing & setting up Keysmith React
Choosing between Page or Settings templates
Generating & managing API tokens with Laravel Sanctum
Customizing permissions and authentication flow
Running tests to ensure everything works smoothly

🎥 Watch the full tutorial here: https://youtu.be/cUyYTp\_eapI

Let me know what you think, and feel free to drop questions in the comments! 🙌

https://redd.it/1jb3pj8
@r_php
Proper way of non permitted action

Let say i hav use case in which only employees that have passed certain condition can be assigned some work.

So inside WorkController assignWork() method I do :

If(!$employee->pass()) {
//what should I do here?
//do i create exception?
//or use flash message to inform and reroute?
}else{
//create form and proceed as usual
}

Preferably i would like to show modal dialog to inform user. So what s best n proper way?

1. Exception or
2. Flash message?
3. Do checking in twig and hide button?

https://redd.it/1jb619p
@r_php
Suggest a best template for building a SDK PHP/Laravel ?

hi,

i recently launched a web screenshot API, i am looking for a template to create a PHP/Laravel SDK for my API, i am good In JavaScript, Haven't used PHP in last few years, can anyone suggest a starter template for a SDK.

https://redd.it/1jbbdbd
@r_php
I took the PHPill

For a while now my default way of building full stack web apps has been Flask + Sqlite + Whatever frontend I felt like. This usualy resulted in bloated, JS-full unmainanble mess. I have dabbled in using Go (Excellent) and Rust (Too type-happy) for my back-end but my front-end usually ended up being the thing that dragged me down. A minor epiphany of mine was discovering HTMX. But recently I got my mind blown by one of my friends who made a whole "smart map" (won't get into more detail) app whilst staying entirely Web 1.0 compliant. This prompted me to try PHP (though she was also using Flask but I didn't know it).

Honestly, the most fun I've had programming in years. In the span of an hour I had made a simple bulletin board app with nothing but html, PHP and SQL. It just blew my mind that you could put the code relevant to a page in the page rather than using templating (though I must concede that Jinja is excellent). I even started to re-learn all of the HTML that years of ChatGPT copy-pasting made me forget. You also get all of the benefits that Go has as a Web first language: the session system just blew my damn mind the first time around: I had no idea cookies without JavaScript were even a thing. Not dreading the inevitable JS blunders or the slog of having to find what part of my code is relevant was awesome.

Plus, I'm not a big framework guy, I don't like using Rails or the likes (Flask is still too pushy for me at times), so I was scared at first that Laravel was a requirement but raw, pure PHP just work, it clicked in my brain, the syntax (apart from the semicolons that aren't used for anything interesting) just clicked with me. Don't even get me started with arrays, its like they copied Lua in advance.

Anyway, what I mean to say is that PHP is a fast, easy to use, and sensical language everyone should absolutely give a shot to. I will definitely be using it in every single one of my projects for the foreseeable future.

https://redd.it/1jbe066
@r_php
Explicit nullable type vs Type Hinting

Are there any technical differences between these?

public function Foo(?int $int = null) {}

and:

public function Foo(int|null $int) {}

https://redd.it/1jbh2ok
@r_php
Using AI for code reviews

Anyone using AI for PHP code reviews? If so, what are you using and how?

I've had a go at it using ChatGPT and my own custom prompts but feels clunky and quite manual. Can't help feeling that there's people out there that are doing it better.

https://redd.it/1jbsabn
@r_php
Community Starter Kits GALLERY update

https://preview.redd.it/1t5x5t02uwoe1.png?width=1413&format=png&auto=webp&s=ebcc033f44461d4da12248a90f8c6db2b033187b



Hey ya!

Some of you might have seen my previous post about a project I was working on a couple days ago

Application here

>TLDR:
Laravel installer now supports community starter kits through the laravel new --using command. While this is a great feature, finding and evaluating different starter kits on GitHub can be time-consuming.
This opensource platform aims to solve that by providing a central place to:

Discover community starter kits
Share starter kits with the community



Since that post, I've made a few additions, including:

Tags to filter through available starterkits (e.g. stripe, vue etc..)

Bookmark your favourites

Ranking system based on number of bookmarks

Layout changes and dark mode fixed

I want to keep the app as usable as possible, while keeping it pretty minimal.


So yeah, if you wanna try out the app or even submit your favourite starterkits, feel free!

If you want to report issues, or feature requests, you can either DM me, or do it via github, either one is fine!


Github ( feel free to star it :D )

https://redd.it/1jc3ys9
@r_php
Build an open-source project to help new people collaborate on PHP open source

I built this system using 'Good First Issue' as a reference, but instead of showing repositories, I prefer to show issues directly, focusing on the PHP language. What do you think about it? I'm new to the open-source world, and this is my first contribution.

Github repository : https://github.com/Danielopes7/php-contributing

Link: https://phpcontributing.com/

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