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
simple.

# Interactive Generation

The generation command showcases the philosophy:

https://preview.redd.it/nxlq3r2o25mf1.png?width=3680&format=png&auto=webp&s=1273d65cc368e40c8712c396f9ca92ab6934dbcd

The interactive prompt shows data type denoscriptions:

* **String** \- Short text, identifiers, URLs (max 255 chars)
* **Single Choice** \- Select dropdown, radio buttons
* **Multi Choice** \- Multiple selections, checkboxes, tags
* etc.

Each selection generates the appropriate:

* Configurator method (`text()`, `singleChoice()`, `numeric()`)
* Form component (`TextInput`, `Select`, `CheckboxList`)
* Smart defaults (validation rules, capabilities)

# Real-World Impact

# For Package Maintainers

* **90% less boilerplate**: field types went from \~200 lines each to \~50 lines
* **Consistent behavior**: Shared configurators eliminated behavioral drift between field types
* **Bulletproof error handling**: No more production crashes from missing field types

# For Package Users

* **30-second field type creation**: Generate → customize → register → done
* **Automatic feature application**: Write simple closures, get advanced features
* **Clear extension patterns**: The configurator API guides you toward best practices

# The Philosophy

The best APIs are the ones that get out of your way. They should:

* **Make easy things trivial** (basic field types)
* **Make complex things possible** (dynamic database options)
* **Make wrong things difficult** (invalid configurations)
* **Make debugging obvious** (clear error messages and graceful degradation)

This field type system achieves all four by being opinionated about structure while flexible about implementation.

# Key Takeaways

1. **Fluent APIs reduce cognitive load** \- Method chaining makes relationships obvious
2. **Automatic feature application** \- Systems should be smart enough to apply features without explicit configuration
3. **Defensive programming pays off** \- Always assume things will be deleted, moved, or broken
4. **Generation > Templates** \- Create working code, not skeletons
5. **Orthogonal design decisions** \- `withoutUserOptions()` works with any choice type because it solves a different problem

Building developer tools is about eliminating friction while maintaining power. This field type system does both.

*Built with Laravel, Filament PHP, and way too much coffee *

https://redd.it/1n3ywjf
@r_php
Anyone tried Vizra?

I am looking to build AI agents on a Laravel app and I’m looking for the most efficient way to do so using a package. So far I’ve seen LarAgents mentioned a few times, but Vizra (https://github.com/vizra-ai/vizra-adk) seems a bit more polished?

Has anyone tried those?

https://redd.it/1n421oe
@r_php
I am working on an API for time conversion.

https://preview.redd.it/56dphgktqamf1.png?width=3092&format=png&auto=webp&s=5257182d2c42180ac9d52ebec3ae4904f2349fe2

Hello, there are surely already 200 that do the same; the intention is for it to be low-cost and that as it becomes profitable, more things can be integrated, such as countries, regionalization, and others. I come to share the idea here since the base is made in Laravel. The intention is for it to be accessible and solve the eternal problem of conversions easily and elegantly. I estimate launching the free version at the end of September to see how it works. Thanks you for your feedback

https://redd.it/1n4nbgw
@r_php
Built a free invoice generator with TALL stack

Hey folks 👋

I put together a simple invoice generator using the TALL stack + Laravel. No signup, no ads—just create and download invoices quickly.

👉 https://getfreecrm.com/tools/invoice-generator

Would love to hear what you think or how I can make it better!

https://redd.it/1n4stc3
@r_php
Uptime monitoring Forge

Hi, what do you guys use to get notified if the web app goes down and can't be accessed? Does Forge have this built in? Or do you use something else? Thanks

https://redd.it/1n4x53l
@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/1n4zy53
@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/1n5dv9t
@r_php
PHP 8.5 introduces a new flag called FILTER_THROW_ON_FAILURE, which, when used, causes the filter function to automatically throw an exception if validation fails, instead of returning false or null.

So, here’s how you would typically validate an email address without the new flag:

    if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
return false;
}



As you can see, you have to manually check the return value and handle the failure.

With the new FILTER_THROW_ON_FAILURE flag, you can simplify this:

    try {
filter_var($email, FILTER_VALIDATE_EMAIL, FILTER_THROW_ON_FAILURE);
return true;
} catch (\Filter\FilterFailedException $e) {
return false;
}


Read more


https://redd.it/1n5gfms
@r_php
Weekly help thread

Hey there!

This subreddit isn't meant for help threads, though there's one exception to the rule: in this thread you can ask anything you want PHP related, someone will probably be able to help you out!

https://redd.it/1n5gukf
@r_php
Symfony Rate Limiter Issue (Maybe?)

I've used this limiter in a few projects and it works as expected by autowiring it in the controller, no problems there.

I wanted to use it as a standalone component within a custom validator. That aside for now, to replicate the issue i am having, if you add this to a controller:

use Symfony\Component\RateLimiter\Storage\InMemoryStorage;
use Symfony\Component\RateLimiter\RateLimiterFactory;
^^^ Remember to add these.

$factory = new RateLimiterFactory(
'id' => 'login',
'policy' => 'token_bucket',
'limit' => 3,
'rate' => ['interval' => '15 minutes',
], new InMemoryStorage());

$limiter = $factory->create();
$limit = $limiter->consume(1);

if (!$limit->isAccepted()) {
dd('limit hit');
}

dd($limit->getRemainingTokens());

Github Repo: https://github.com/symfony/rate-limiter

The above code is in the README of the repo. What i would expect on every refresh is the remaining tokens to count down then hit the limit but this will always show 2 remaining.

From looking at it, the storage is getting renewed every time and not persistent, but this is the "Getting started" code...

What am i doing wrong?

https://redd.it/1n5lw6k
@r_php
An alternative approach to Laravel route localization

Hey r/laravel, 👋

I'd like to share the package I've been working on. https://github.com/goodcat-dev/laravel-l10n

The core idea is to define localized routes and route translations directly in your routes/web.php file using the Route::lang() method. Here's an example:

Route::get('{lang}/example', Controller::class)
->lang(
'fr', 'de',
'it' => 'it/esempio',
'es' => 'es/ejemplo'
);

This single route definition handles:

`/{lang}/example` for French `fr/example` and German `de/example`.
Translated routes it/esempio, es/ejemplo.
`/example` for English, the default locale.

The main features I focused on were:

All route definitions in one place, with no need for separate translation files.
Automatically generates the correct URL for the active locale with the standard `route()` helper.
Automatically looks for locale-specific view files (e.g. views/es/example.blade.php) and falls back to the generic view if no localized version is found.
A mechanism to detect a user's preferred language based on the `Accept-Language` header and model that implements the `HasLocalePreference` interface.
No custom route:cache command required.

This package is still experimental, so there may be some bugs. I'd like to hear your thoughts on this approach to localization. What do you think?

You can check it out here: https://github.com/goodcat-dev/laravel-l10n

https://redd.it/1n5rhrf
@r_php
SheafUI: A 100% free Laravel Blade UI platform with CLI install, 33+ components, and full code ownership

We just released **SheafUI**, an open-source UI platform for Laravel developers.

The philosophy is simple:

* **Your code should be yours** : every component you install is native Blade + Alpine, copied into your project (no vendor lock) and supportable both alpine and livewire.
* **No copy-paste:** install with one command using the SheafUI CLI.
* **All free:** 33+ components today, with more coming soon.

Example:

php artisan sheaf:init
php artisan sheaf:install button

After that, the component lives in resources/views/components/ui/, fully editable and owned by you.

Website: [sheafui.dev](http://sheafui.dev)
CLI repository: [https://github.com/sheafui/cli](https://github.com/sheafui/cli)
Components repository: [https://github.com/sheafui/components](https://github.com/sheafui/components)

We’d love feedback from the Laravel community, which components would you like to see added next?

https://redd.it/1n5uax5
@r_php
Laravel Deployment on multi-project server

I manage a Hetzner server running three Laravel projects under HestiaCP and Debian.
Right now deployments run from a GitHub Actions workflow that uses SSH into the server and runs a remote deploy noscript whenever a PR is merged.

This works but doesn’t scale.
What deployment strategy would you recommend for a multi-project server like this?

https://redd.it/1n5xhst
@r_php
Config mixture: the Laravel way

I’m trying to add an external config source to my project. This config source I can access over HTTP. However, I would like to keep using config() to access configuration values.

On top of that, the values that I receive from the external source might be a reference to some env() value or another key in that external source.

Env values I have are coming either from .env file or OS.

So, I have a mixture of everything here.

What is THE Laravel way to configure such configuration sources?

https://redd.it/1n629rt
@r_php
What SAST/DAST Tools Work for you?

Even devs who know the OWASP Top 10 by heart can still write vulnerable code. SQL injections, XSS, IDOR - you name it — mistakes happen. That’s where tools like SAST and DAST come in, and I’m curious about what’s working for the community.

In my latest newsletter, I mentioned tools like Composer audit, Psalm, and PHPStan for catching issues early, and Trivy or Hadolint for infrastructure-level checks. I’ve also seen commercial options like Snyk or Sonar’s RIPS, but I’ve found them hit-or-miss with false positives or missing real issues. So far, none of the tools made me feel really safe, so I’m wondering: what SAST or DAST tools do you rely on in your PHP projects? Are there any you can recommend?

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