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
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
Effortless Laravel & Inertia Data and Type Sync

Hey Laravel Devs 👋

If you're using Laravel with Inertia.js, you know the struggle of keeping your backend data structures and frontend TypeScript types in sync. It's tedious and error-prone.

Here's what you'll learn:

Backend configuration with Spatie Data
Frontend integration for automatic type generation
Tips and Tricks

https://www.alializadehdev.com/blogs/effortless-laravel-and-inertia-data-and-type-sync-dto-magic

https://redd.it/1jchvzv
@r_php
City State Registration

What is the best way to allow users selected a city once a state has been chosen during their user registration ? Is creating a City table referencing the state table feasible? Or would it be too large of a table and slow down website ?

https://redd.it/1jcjipj
@r_php
React.js in PHP?

I've been too preoccupied with whether I could, that I haven't cared the slightest about whether I should, and thus I've been chipping away at a PHP to JS transpiler which is now capable of just about enough that I have a very basic React.js app running in the browser, written in PHP.

This is the PHP code that makes it run: https://github.com/nomaphp/js/blob/main/examples/complex/react.php

This is the resulting JS: https://github.com/nomaphp/js/blob/main/examples/complex/react.js

And the whole thing put together: https://github.com/nomaphp/js/blob/main/examples/complex/test.php

So to be clear - it is not PHP running the front-end, it's JavaScript, but you write PHP which gets transpiled to JavaScript. My test example does run-time transpilation, but of course for performance reasons you'd probably want to cache it or just write the resulting JS into a .js file or something.

Been having a lot of fun with this! Why would anyone use this? Well for me the benefits are statically typed code (though you lose runtime validation of course) and the ability to share code, so if I have a utility function in PHP I can then also use the same exact function for my front-end. It's an extremely basic proof of concept, so don't think of it as anything serious just yet.

https://redd.it/1jcpbb8
@r_php
Shaping the Future of Laravel's API Starter Kit – What Should It Include?

Hey everyone!

With Laravel working on its own API starter kit, now is a great time for the community to define what a modern, well-architected REST API should look like. I’m starting a freelance project that involves building a large-scale REST API for a web and mobile ecosystem, as well as third-party integrations as a paid service. I want to align my approach with best practices and contribute to the broader discussion on what should be included in Laravel’s API tooling.

Here’s my initial list of must-have features:

* **JSON:API specification** as a baseline, with additional standards for dates (ISO 8601), country/currency codes, etc.
* **Stateless design** with proper HTTP verbs, status codes, semantic versioning in the URL, and cacheability (`Cache-Control`).
* **Rate limiting** to ensure fair usage and prevent abuse.
* **Comprehensive documentation** using OpenAPI.
* **CI/CD pipeline** with GitHub Actions for automated testing and deployment.

For those who have built APIs with Laravel, what else would you consider essential? What conventions, packages, or best practices should Laravel’s API starter kit include? Let’s make this a solid reference for modern API development in Laravel!

https://redd.it/1jcsh7k
@r_php
Building a State-of-the-Art REST API – What would you include?

Hi there!

I'm starting a new freelance project (with Laravel) - a large-scale REST API designed to power an ecosystem of web and mobile applications, as well as serve third-party integrations as a paid service. My goal is to make this API state-of-the-art by implementing best practices from the start.

I'm compiling a list of essential features and design principles, and I'd love to hear your thoughts! If you were given a chance to build the next "perfect API", what would you include?

Here’s my initial list:

* **JSON:API specification** as the baseline, with additional standards for dates (ISO 8601), country/currency codes, etc.
* **Stateless design** with proper use of HTTP verbs, status codes, semantic versioning in the URL, and cacheability (via `Cache-Control`).
* **Rate limiting** to prevent abuse and ensure fair usage.
* **Comprehensive documentation** using OpenAPI.
* **CI/CD pipeline** with GitHub Actions for automated testing and deployment.

What would you add to this list? Any best practices, tools, or lessons learned from your own experience?

Thanks!

https://redd.it/1jcsb03
@r_php
Weekly /r/Laravel Help Thread

Ask your Laravel help questions here. To improve your chances of getting an answer from the community, here are some tips:

What steps have you taken so far?
What have you tried from the documentation?
Did you provide any error messages you are getting?
Are you able to provide instructions to replicate the issue?
Did you provide a code example?
Please don't post a screenshot of your code. Use the code block in the Reddit text editor and ensure it's formatted correctly.

For more immediate support, you can ask in the official Laravel Discord.

Thanks and welcome to the r/Laravel community!

https://redd.it/1jcq1wj
@r_php
Q: AI to make php layout from word.doc

Like the noscript says. Is there an AI program, or any program/website that can convert a word.doc or PDF into a php ready web layout? I would map the back end parameters.

The source docs would be forms with check boxes and text fields.

I found a site that converts PDFs to HTML format but that didn't really help. I would need the layout.php ya?

Thanks all for any suggestions.

https://redd.it/1jcxgsq
@r_php
Weekly Ask Anything Thread

Feel free to ask any questions you think may not warrant a post. Asking for help here is also fine.

https://redd.it/1jd3bg8
@r_php
Laravel 12 + Sail Docs Removed?

It seems like a lot of the documentation for Sail has been removed for Laravel 12x.

For example, there used to be instructions for a fresh Laravel Sail install without installing PHP/Composer locally, choosing your services, etc.

https://laravel.com/docs/11.x/installation

It looks like they include Sail by default with 12.x or something?

But it is weird they would remove this info and laravel.build URL from the docs, as well as that command for developers to run everything within the container locally to get started.

Sail is still the easiest way to get started with Laravel, even with all this https://php.new bullshit. I would hate to see it get sidelined by Herd and other things.

https://redd.it/1jd6fh5
@r_php
Dutch PHP Conference 2025

Hi all; any people from our little corner of the Reddits, other than the esteemed u/brendt_gd as a speaker, joining the Dutch PHP Conference this year? If so, this is an open invite to come and say hi - would love to spend this opportunity meeting some of you face to face.

I'm Sander, part of the Egeniq crew, helping iBuildings run the combined DPC/ADC/WDC conferences. Feel free to ask any of my colleagues to point you in my direction, or come find me after my talk during the 10:55-11:40 timeslot.

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