Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 14, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 14, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 14, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 14, 2025

      I test a lot of AI coding tools, and this stunning new OpenAI release just saved me days of work

      May 14, 2025

      How to use your Android phone as a webcam when your laptop’s default won’t cut it

      May 14, 2025

      The 5 most customizable Linux desktop environments – when you want it your way

      May 14, 2025

      Gen AI use at work saps our motivation even as it boosts productivity, new research shows

      May 14, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025
      Recent

      Strategic Cloud Partner: Key to Business Success, Not Just Tech

      May 14, 2025

      Perficient’s “What If? So What?” Podcast Wins Gold at the 2025 Hermes Creative Awards

      May 14, 2025

      PIM for Azure Resources

      May 14, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025
      Recent

      Windows 11 24H2’s Settings now bundles FAQs section to tell you more about your system

      May 14, 2025

      You can now share an app/browser window with Copilot Vision to help you with different tasks

      May 14, 2025

      Microsoft will gradually retire SharePoint Alerts over the next two years

      May 14, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»URI Parsing and Mutation in Laravel 11.35

    URI Parsing and Mutation in Laravel 11.35

    December 20, 2024

    URI Parsing and Mutation in Laravel 11.35

    This week, the Laravel team released v11.35, which includes URI parsing and mutation, the ability to disable HTTP client exception response truncation, transforming an HTTP response to a Fluent instance, and more.

    URI Parsing and Mutation

    Taylor Otwell contributed a Uri class for URI parsing and mutation.

    $uri = Uri::of('https://laravel.com')
        ->withQuery(['name' => 'Taylor'])
        ->withPath('/docs/installation')
        ->withFragment('hello-world');
    
    $uri->scheme();
    $uri->host();
    $uri->user();
    $uri->password();
    $uri->path();
    $uri->port();
    $uri->query()->all();
    $uri->query()->has('name');
    $uri->query()->missing('name');
    $uri->query()->decode();
    
    // And more...
    
    return (string) $uri;
    

    You can also retrieve a URI instance from the current request, named routes, and URLs:

    $uri = $request->uri();
    
    $uri = Uri::to('/something')->withQuery(...);
    
    $uri = Uri::route('named-route', ['user' => $user]);
    

    See Pull Request #53731 for more details.

    Customize or Disable HTTP Client Exception Message Truncation

    Steve Bauman contributed the ability to customize or disable HTTP client response truncation via the application bootstrap configuration. In the withExceptions() callback, you can customize the truncation length or disable fully disable it with the following:

    // bootstrap/app.php
    
    use IlluminateHttpClientRequestException;
    
    return Application::configure(basePath: dirname(__DIR__))
        // ...
        ->withExceptions(function (Exceptions $exceptions) {
            $exceptions->dontTruncateRequestExceptions();
    
            // Or ...
    
            $exceptions->truncateRequestExceptionsAt(260);
        })->create();
    

    Transform HTTP Client Response Data into a Fluent Instance

    Steve Bauman contributed the ability to transform an HTTP Client response data into a fluent instance:

    $fluent = Http::get('https://api.example.com/products/1')->fluent();
    
    $fluent->float('price'); // 420.69
    $fluent->collect('colors'); // Collection(['red', 'blue'])
    $fluent->boolean('on_sale'); // true
    $fluent->integer('current_stock'); // 69
    

    Add The Conditionable Trait to Request

    Ahmet Imamoglu added the Conditionable trait the the HTTP request. Just like the query builder, you can use when() in a request class:

    /**
     * Prepare the data for validation.
     */
    protected function prepareForValidation(): void
    {
        $this->when($this->input('account_id'),
            fn (Request $req, int $accountId) => $req->merge(['account_name' => Account::getName($accountId)]),
            fn (Request $req) => $req->merge(['account_name' => null])
    
        )->when($this->input('contact_id'),
            fn (Request $req, int $contactId) => $req->merge(['contact_name' => Contact::getName($contactId)]),
            fn (Request $req) => $req->merge(['contact_name' => null])
        );
    }
    

    Allow Sorting Routes by Definition in route:list

    Mathieu TUDISCO contributed the ability to sort route:list results by definition:

    php artisan route:list --sort=definition
    

    Here’s how it works by default and then using the definition value:

    Schedule Handling: Ping on Success and Failure

    Luca Castelnuovo contributed pingOnSuccessIf() and pingOnFailureIf() to schedule handling. This allows the scheduler to ping a URL when a task fails or succeeds:

    $pingBackupRun = (bool) config('services.ohdear.tasks.backup:run', false);
    $pingBackupRunUrl = config('services.ohdear.tasks.backup:run');
    
    Schedule::command('backup:run')->hourly()
        ->pingBeforeIf($pingBackupRun, $pingBackupRunUrl . '/starting')
        ->pingOnSuccessIf($pingBackupRun, $pingBackupRunUrl . '/finished')
        ->pingOnFailureIf($pingBackupRun, $pingBackupRunUrl . '/failed');
    

    See Pinging URLs in the Laravel documentation.

    Release notes

    You can see the complete list of new features and updates below and the diff between 11.34.0 and 11.35.0 on GitHub. The following release notes are directly from the changelog:

    v11.35.0

    • [11.x] Supports Symfony 7.2 by @crynobone in https://github.com/laravel/framework/pull/53585
    • [11.x] Fix database reconnecting logic by @stancl in https://github.com/laravel/framework/pull/53693
    • [11.x] Test Improvements by @crynobone in https://github.com/laravel/framework/pull/53708
    • [11.x] Fix foreignIdFor() when the foreign key is a non-incrementing integer other than ULID by @edgrosvenor in https://github.com/laravel/framework/pull/53696
    • [11.x] Allow sorting routes by precedence in artisan routes:list. by @mathieutu in https://github.com/laravel/framework/pull/53706
    • [11.x] Update the message for the schedule:work command. by @AbdelElrafa in https://github.com/laravel/framework/pull/53710
    • [11.x] Support auto-discovery of PSR-17 implementations by @hafezdivandari in https://github.com/laravel/framework/pull/53711
    • [11.x] Improve Error Handler in the ProcessDriver by @WillTorres10 in https://github.com/laravel/framework/pull/53712
    • [11.x] Comment grammar fixes by @nexxai in https://github.com/laravel/framework/pull/53714
    • [11.x] Replace get_called_class with static::class by @fernandokbs in https://github.com/laravel/framework/pull/53725
    • [11.x] Add the pivot’s related model when creating from attributes by @alexwass-lr in https://github.com/laravel/framework/pull/53694
    • [11.x] use a consistent alias for IlluminateDatabaseEloquentCollection by @browner12 in https://github.com/laravel/framework/pull/53730
    • [11.x] switch Collection::make() for new Collection() by @browner12 in https://github.com/laravel/framework/pull/53733
    • [11.x] always alias the IlluminateDatabaseEloquentCollection by @browner12 in https://github.com/laravel/framework/pull/53735
    • [11.x] convert collect() helper to new Collection() by @browner12 in https://github.com/laravel/framework/pull/53726
    • [11.x] Improves Collection support for enums using firstWhere() and value() by @crynobone in https://github.com/laravel/framework/pull/53777
    • [11.x] Add Conditionable Trait to Request by @ahmeti in https://github.com/laravel/framework/pull/53775
    • [11.x] Ignore health endpoint when in maintenance mode by @joshmanders in https://github.com/laravel/framework/pull/53772
    • [11.x] Add ability to transform HttpClientResponse into Fluent by @stevebauman in https://github.com/laravel/framework/pull/53771
    • set schema to smtps if MAIL_ENCRYPTION === tls by @danielrona in https://github.com/laravel/framework/pull/53749
    • [11.x] more consistent and readable chaining by @browner12 in https://github.com/laravel/framework/pull/53748
    • [11.x] Fix the RateLimiter issue when using dynamic keys by @MilesChou in https://github.com/laravel/framework/pull/53763
    • [11.x] Add ability to customize or disable HttpClientRequestException message truncation by @stevebauman in https://github.com/laravel/framework/pull/53734
    • [11.x] Include the initial value in the return types of reduce() by @lorenzolosa in https://github.com/laravel/framework/pull/53798
    • [11.x] Add pingOnSuccessIf & pingOnFailureIf to Schedule handling by @lucacastelnuovo in https://github.com/laravel/framework/pull/53795
    • [11.x] Improve PHPDoc for nullable properties in IlluminateDatabaseQueryBuilder class by @xurshudyan in https://github.com/laravel/framework/pull/53793
    • [11.x] Remove usage of compact() in Container by @KennedyTedesco in https://github.com/laravel/framework/pull/53789
    • [11.x] Make Exceptions@dontTruncateRequestExceptions() fluent by @cosmastech in https://github.com/laravel/framework/pull/53786
    • [11.x] Make mailables tappable by @kevinb1989 in https://github.com/laravel/framework/pull/53788
    • URI by @taylorotwell in https://github.com/laravel/framework/pull/53731
    • [11.x] Require laravel/serializable-closure on Database component by @patrickcarlohickman in https://github.com/laravel/framework/pull/53822
    • [11.x] use new PHP 8 str_ functions by @browner12 in https://github.com/laravel/framework/pull/53817
    • [11.x] handle password_hash() failures better by @browner12 in https://github.com/laravel/framework/pull/53821
    • [11.x] remove unnecessary return statement by @browner12 in https://github.com/laravel/framework/pull/53816
    • [11.x] simplify passing arguments to when() by @browner12 in https://github.com/laravel/framework/pull/53815
    • [11.x] remove redundant array_values call by @browner12 in https://github.com/laravel/framework/pull/53814
    • [11.x] prefer assignment over array_push for 1 element by @browner12 in https://github.com/laravel/framework/pull/53813
    • [11.x] fix chopStart and chopEnd tests by @browner12 in https://github.com/laravel/framework/pull/53812
    • [11.x] remove temporary variables by @browner12 in https://github.com/laravel/framework/pull/53810
    • [11.x] fix $events docblock type by @browner12 in https://github.com/laravel/framework/pull/53808
    • [11.x] Fix docblock for URI by @cosmastech in https://github.com/laravel/framework/pull/53804
    • Bump nanoid from 3.3.7 to 3.3.8 in /src/Illuminate/Foundation/resources/exceptions/renderer by @dependabot in https://github.com/laravel/framework/pull/53831
    • [11.x] use promoted properties by @browner12 in https://github.com/laravel/framework/pull/53807
    • Revert “[11.x] use promoted properties” by @taylorotwell in https://github.com/laravel/framework/pull/53832
    • Using throw config of filesystem disks when faking by @emulgeator in https://github.com/laravel/framework/pull/53779
    • [11.x] Fix schema names on DatabaseTruncation trait (PostgreSQL and SQLServer) by @hafezdivandari in https://github.com/laravel/framework/pull/53787

    The post URI Parsing and Mutation in Laravel 11.35 appeared first on Laravel News.

    Join the Laravel Newsletter to get all the latest
    Laravel articles like this directly in your inbox.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleUsing Fluent to Work With HTTP Client Responses in Laravel
    Next Article Paginate Multiple Eloquent Models with the Union Paginator Package

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 15, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4695 – PHPGurukul Cyber Cafe Management System SQL Injection

    May 15, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    ToddyCat Hacker Group Uses Advanced Tools for Industrial-Scale Data Theft

    Development

    Trump Campaign Accuses Iranian Hackers of Internal Document Theft

    Development

    The coolest accessories for Steam Deck and Rog Ally are up to half price — but hurry, you’ve only got until midnight

    Development

    Sitecore 10.4 is out and here’s all you need to know about it

    Development

    Highlights

    Microsoft Access introduces magnification slider for enhanced usability

    April 14, 2025

    Microsoft has announced a significant accessibility enhancement for its database management tool, Microsoft Access: a…

    How to Add Page Numbers and Sections in Adobe InDesign

    May 14, 2025

    Drag & Drop issue in selenium web driver

    August 6, 2024

    Top Artificial Intelligence (AI) Governance Laws and Frameworks

    May 2, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.