Best of PHPJune 2025

  1. 1
    Article
    Avatar of medium_jsMedium·45w

    5 Hidden Laravel Features That Will Instantly Clean Up Your Code

    Laravel offers several underutilized features that can significantly improve code quality and readability. Key features include @forelse for handling empty collections in Blade templates, when() method for conditional query building, sortByDesc() for collection sorting, isEmpty() for cleaner empty checks, and whereRelation() for simplified relationship filtering in Laravel 9+. These methods replace verbose conditional statements and make code more expressive and maintainable.

  2. 2
    Article
    Avatar of larablogLarablog·42w

    Build A Search UI

    A step-by-step guide to building a basic search UI using TypeSense and Laravel. Covers creating a simple Blade view with a search form, integrating TypeSense client to query a books collection, and displaying results in a styled list. The tutorial demonstrates setting up routes, handling query parameters, performing searches on the title field, and using Tailwind CSS for styling. This foundation prepares for more advanced features like instant search, result highlighting, and faceted filtering.

  3. 3
    Article
    Avatar of laraveldevLaravel Dev·41w

    Why Laravel Developers Need to Think Like Hackers

    Laravel provides excellent security defaults like CSRF protection and input validation, but developers often break the security model through poor implementation. Hackers exploit assumptions by testing unexpected inputs, bypassing validation, and accessing hidden routes. To build truly secure applications, developers need to adopt a hacker mindset: assume the worst, test edge cases, audit trust boundaries, and validate data at multiple layers. The article demonstrates this with a file upload vulnerability example where a PHP file disguised as JPG bypassed validation and granted shell access.

  4. 4
    Article
    Avatar of lnLaravel News·45w

    Laravel OpenRouter

    A new Laravel package enables easy integration with OpenRouter, a unified API for accessing multiple Large Language Models. The package supports both standard and streaming chat requests, allowing developers to interact with various AI models like Mistral through a single interface. It includes features for real-time streaming responses and can be easily installed via Composer.

  5. 5
    Article
    Avatar of medium_jsMedium·44w

    Level Up Your Laravel Forms with These 5 Validation Tricks

    Laravel offers advanced validation techniques beyond basic rules like 'required' and 'email'. Five key methods include Rule::when() for conditional validation, bail to stop at first failure, asterisk notation for dynamic array validation, sometimes for optional field validation, and validated() method to safely retrieve only validated data instead of all input.

  6. 6
    Article
    Avatar of lnLaravel News·42w

    PayHere for Laravel

    Laravel PayHere is a third-party package that integrates PayHere payment gateway (popular in Sri Lanka) into Laravel applications. It supports both onsite and offsite checkout flows, webhook handling, subscription management, and includes a Filament admin panel. The package provides a Billable trait for User models, RESTful API communication, HTML form builders, and Blade components for payment buttons. Installation is done via Composer with additional setup commands for assets and configuration.

  7. 7
    Video
    Avatar of awesome-codingAwesome·42w

    How a solo dev got rich by building Laravel...

    Taylor Otwell's journey from a solo developer in Arkansas to Laravel's creator demonstrates how solving personal problems can lead to massive success. Starting as a private project to build PHP web apps faster, Laravel generated no revenue for three years until Forge, a deployment tool, provided the breakthrough that allowed Otwell to quit his day job in 2015. The story emphasizes two key principles: solve real problems you face personally, and tackle the hard parts first rather than perfecting superficial features.

  8. 8
    Article
    Avatar of lnLaravel News·43w

    Lightning Fast Schedule Management for Laravel

    Laravel Zap is a flexible schedule management package that provides deep Laravel integration for creating calendar schedules, managing appointments, and handling recurring events. It offers features like availability checking, conflict detection, time slot generation, and supports various scheduling patterns including daily, weekly, and monthly recurrences. The package includes a fluent API for creating schedules, checking availability, finding conflicts, and managing time-based operations with timezone support.

  9. 9
    Article
    Avatar of phpdevPHP Dev·41w

    Laravel & PHP Top this week

    Weekly roundup featuring top PHP and Laravel content including David Carr's guide on PHP strict vs weak types, Matt Stauffer and André Valentin's discussion on empathetic engineering leadership, and Paul Underwood's tutorial on Laravel Docker deployment with automated CI/CD using GitHub Actions.

  10. 10
    Article
    Avatar of lnLaravel News·42w

    Defining a Dedicated Query Builder in Laravel 12 With PHP Attributes

    Laravel 12.19 introduces the UseEloquentBuilder PHP attribute as a cleaner way to define custom query builders for Eloquent models. Instead of overriding the newEloquentBuilder() method, developers can now use this attribute to specify a custom builder class. Custom query builders help organize model scopes, reduce model bloat, and provide reusable query methods. The custom builder class must extend Laravel's Builder class and can include methods like wherePublished() for common query patterns.

  11. 11
    Article
    Avatar of communityCommunity Picks·44w

    nunomaduro/essentials: Just better defaults for your Laravel projects.

    Laravel Essentials is a package that provides better defaults for Laravel applications, including strict models that prevent lazy loading and undefined attribute access, automatic eager loading of relationships, immutable dates using CarbonImmutable, HTTPS enforcement, and safety features for production environments. The package also includes Artisan commands for generating action classes and configuring code quality tools like Pint and Rector with opinionated settings for strict types, final classes, and code organization.

  12. 12
    Article
    Avatar of freekFREEK.DEV·45w

    PHP 8.4's new Dom\HTMLDocument in Diffs

    PHP 8.4 introduces a new Dom\HTMLDocument class that provides improved HTML document handling with better standards compliance and fixes for long-standing bugs present in the legacy DOMDocument class. This new implementation makes HTML manipulation more reliable and easier to work with for developers.

  13. 13
    Article
    Avatar of collectionsCollections·44w

    Building 'Architect': A Laravel and HTMX Integration Course

    A comprehensive guide to building an interactive novel outlining application called 'Architect' using Laravel and HTMX. The tutorial covers setting up a Laravel environment, creating CRUD operations, enhancing user interactions with HTMX attributes for dynamic content loading, and implementing Laravel Blade fragments for efficient partial content rendering. The approach emphasizes progressive enhancement, ensuring the application works with or without JavaScript while providing a modern interactive experience.

  14. 14
    Article
    Avatar of lnLaravel News·43w

    Manipulate Image URLs in Laravel with the Image Transform Package

    A new Laravel package called laravel-image-transform-url provides a lightweight solution for manipulating images through URL parameters. Inspired by Cloudflare Images, it allows developers to transform images on-the-fly by appending query parameters for width, quality, format, and other modifications. The package includes built-in performance features like automatic caching, storage of processed images, rate limiting, and CDN integration support. It uses Intervention Image for file manipulations and offers a self-hosted alternative to external image processing services.

  15. 15
    Article
    Avatar of laravelLaravel·42w

    Building a Multi-Tenant Architecture Platform to Scale the Emmys

    Crowd Favorite built Orthicon, a multi-tenant Laravel platform for Emmy Awards competitions, serving multiple regional chapters from a single codebase. The architecture uses lightweight tenant identification via HTTP headers, Eloquent global scopes for data isolation, dynamic configuration through service providers, and tenant-aware caching and queues. This approach enabled NATAS to handle a 570% user spike while maintaining data security and allowing rapid deployment of new competitions without separate server instances.

  16. 16
    Article
    Avatar of phpdevPHP Dev·43w

    My Lego ElePHPant

    JetBrains provides downloadable PDF instructions for building a Lego version of the PHP ElePHPant mascot. The guide offers step-by-step directions to create the iconic elephant using standard Lego bricks.

  17. 17
    Article
    Avatar of lnLaravel News·44w

    Laravel Audit Log

    Laravel Audit Log is a package that provides comprehensive audit logging for Laravel applications by tracking all changes to Eloquent models. It creates dedicated audit tables for each model, logs CRUD operations with old and new values, tracks change sources (HTTP, console, etc.), and identifies users responsible for changes. The package uses a simple trait-based approach and offers customizable field logging for compliance and debugging purposes.

  18. 18
    Article
    Avatar of lnLaravel News·45w

    Laravel News

    Prism Relay is a PHP package that bridges PrismPHP with Model Context Protocol (MCP) servers, enabling AI applications to access external tools and capabilities. It supports multiple MCP server connections through HTTP and STDIO transport mechanisms, with features like configurable timeouts, environment variables, and caching. The package allows developers to enhance their AI applications by integrating tools like web scraping, screenshot capture, and browser automation through MCP servers such as Puppeteer.

  19. 19
    Article
    Avatar of collectionsCollections·43w

    Introducing Laravel Nightwatch: Advanced Monitoring for Laravel Applications

    Laravel Nightwatch is a new monitoring service designed specifically for Laravel applications, offering advanced production-grade monitoring capabilities beyond Laravel Telescope and Pulse. It provides deep performance insights, real-time visibility, comprehensive tracking of requests and events, and scalable architecture handling billions of events. The service features a free tier supporting 200k events monthly, with paid plans starting at $20/month for 5M events, making it accessible for projects of all sizes.

  20. 20
    Article
    Avatar of wordpresscoreMake WordPress Core·43w

    Introducing a new SQLite driver for WordPress – WordPress Playground

    WordPress has released a new SQLite driver that provides better MySQL compatibility through advanced query parsing and emulation. The driver features a complete MySQL lexer and grammar parser written in PHP, supports complex SQL operations like subqueries and UNION statements, and includes MySQL information schema emulation. It's currently available as a feature flag in the SQLite Database Integration plugin v2.2.1+ and powers WordPress Playground. The new architecture enables more robust MySQL feature support and lays groundwork for future database engine compatibility within WordPress.

  21. 21
    Article
    Avatar of laraveldevLaravel Dev·41w

    Laravel 10 JWT Authentication: Secure Login & API Tokens

    A tutorial covering JWT (JSON Web Token) authentication implementation in Laravel 10, focusing on secure user login and API token management. The content demonstrates how to set up JWT-based authentication for API endpoints, handle token generation and validation, and implement secure login mechanisms in Laravel applications.

  22. 22
    Article
    Avatar of communityCommunity Picks·44w

    Speed Up Your Laravel App with Concurrency (Beta Feature)

    Laravel 11 introduces a beta Concurrency feature that allows developers to run multiple independent tasks in parallel, improving application performance. The feature supports three drivers (process, fork, sync) and enables both immediate parallel execution and deferred execution after HTTP responses. Tasks are executed in separate PHP processes through serialized closures, making it possible to run database queries, API calls, or other time-consuming operations simultaneously without external job queues.

  23. 23
    Article
    Avatar of hnHacker News·45w

    bearstech/phptop: PHP basic ressource profiler (CPU/memory), safe and useful for production sites

    phptop is a lightweight PHP resource profiler that monitors CPU time, memory usage, and other metrics for production websites. It requires minimal configuration (single line in php.ini) and provides per-query statistics similar to the Unix 'time' command. The tool has been production-tested for years and supports PHP 5.2.0 through 8.2, making it suitable for monitoring LAMP server performance without significant overhead.

  24. 24
    Article
    Avatar of lnLaravel News·43w

    Larallow is a Permissions Package With Support for Scopes

    Larallow is a new Laravel package for managing roles and permissions with advanced features like scoped roles, polymorphic relations, and translation support. It provides a fluent API for creating permissions, assigning them to users through roles or directly, and checking capabilities. Key features include support for multiple actor models, scoped permissions via polymorphic relationships, built-in translation support, and Blade directives for view-level permission checks. The package is still in early development and hasn't reached v1.0.0 yet.

  25. 25
    Article
    Avatar of phpdevPHP Dev·43w

    NeuronAI ADK: PHP Framework for supercharge Your PHP Apps with Autonomous AI Agents

    NeuronAI ADK is an open-source PHP framework designed specifically for integrating AI agents into PHP applications. Built natively for PHP 8.1+, it supports popular frameworks like Laravel, Symfony, and WordPress, connects to various LLM providers including OpenAI and Claude, and includes features like RAG implementation, built-in tools, scaling capabilities with Redis and RabbitMQ, and comprehensive observability options.