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

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

      May 19, 2025

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 19, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 19, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 19, 2025

      My latest hands-on could be the best value AI laptop of the summer, but I still have questions

      May 19, 2025

      DOOM: The Dark Ages had the lowest Steam launch numbers in series history — Is it suffering from the ‘Game Pass Effect’?

      May 19, 2025

      Microsoft won’t be left exposed if something “catastrophic” happens to OpenAI — but may still be 3 to 6 months behind ChatGPT

      May 19, 2025

      Microsoft Copilot gets OpenAI’s GPT-4o image generation support — but maybe a day late and a dollar short for the hype?

      May 19, 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

      ES6: Set Vs Array- What and When?

      May 19, 2025
      Recent

      ES6: Set Vs Array- What and When?

      May 19, 2025

      Transform JSON into Typed Collections with Laravel’s AsCollection::of()

      May 19, 2025

      Deployer

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

      My latest hands-on could be the best value AI laptop of the summer, but I still have questions

      May 19, 2025
      Recent

      My latest hands-on could be the best value AI laptop of the summer, but I still have questions

      May 19, 2025

      DOOM: The Dark Ages had the lowest Steam launch numbers in series history — Is it suffering from the ‘Game Pass Effect’?

      May 19, 2025

      Microsoft won’t be left exposed if something “catastrophic” happens to OpenAI — but may still be 3 to 6 months behind ChatGPT

      May 19, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»A New String Helper, Assert Enums in AssertableJson, and more in Laravel 11.20

    A New String Helper, Assert Enums in AssertableJson, and more in Laravel 11.20

    August 7, 2024

    The Laravel team released v11.20 this week, including a new collection method, a deduplicate string method, the ability to use Enums with AssertableJson, and more.

    Add collapseWithKeys to Collection

    Jason McCreary contributed a collapseWithKeys() method to the IlluminateSupportCollection class that collapses nested arrays while preserving their keys:

    $c = collect([[1 => ‘a’], [3 => ‘c’], [2 => ‘b’]]);
    $c->collapseWithKeys();
    /*
    [
    1 => “a”,
    3 => “c”,
    2 => “b”,
    ]
    */

    Add deduplicate to strings

    Jason McCreary contributed a deduplicate string helper that replaces consecutive occurrences of a character with a character:

    Str::deduplicate(‘random double spaces’); // ‘random double spaces’
    Str::deduplicate(‘/some//odd/path//’, ‘/’); // ‘/some/odd/path/’
    (string) str(‘zondaaaa’)->deduplicate(‘a’); // ‘zonda’

    Allow Custom View Path When Making Components

    Andrew Brown contributed the ability to define a –path flag when you need to create the view path in a custom file location:

    php artisan make:component Foo –path custom/path

    By default, the make:component command will continue to use the resources/views/components folder.

    Introduce a MixFileNotFoundException Exception Class

    Ihor Vereshchynskyi contributed a new MixFileNotFoundException class to handle missing Mix files. This exception provides a more precise error-handling mechanism when this exception gets thrown.

    Allow enums to be passed to AssertableJson where methods

    Patrick O’Meara contributed the ability to use Enums while using where* methods with AssertableJson instances:

    // Before
    fn (AssertableJson $json) => $json->where(‘role’, UserRole::Developer->value)

    // After
    fn (AssertableJson $json) => $json->where(‘role’, UserRole::Developer)

    Prompt to Create a Markdown Template When Making Notifications

    Christoph Rumpel updated the make:notification command to prompt for creating an optional markdown view when you don’t provide any initial input:

    php artisan make:notification

    You will get the following prompts to select a markdown view for your notification class:

    Markdown view prompts in the make:notification command

    Add stackContains() and hiddenStackContains() Methods to Context Stacks

    @lessevv contributed the ability to check if a value (or hidden value) is contained in a context stack. Here are a few examples from Pull Request #52346:

    // Normal
    Context::push(‘foo’, ‘bar’, ‘lorem’);

    Context::stackContains(‘foo’, ‘bar’); // true
    Context::stackContains(‘foo’, ‘lorem’); // true
    Context::stackContains(‘foo’, ‘doesNotExist’); // false

    // Hidden
    Context::pushHidden(‘foo’, ‘bar’, ‘lorem’);

    Context::hiddenStackContains(‘foo’, ‘bar’); // true
    Context::hiddenStackContains(‘foo’, ‘lorem’); // true
    Context::hiddenStackContains(‘foo’, ‘doesNotExist’); // false

    Inverse Fake Queue Assertion Methods

    Günther Debrauwer contributed assertNotDeleted, assertNotFailed, and assertNotReleased assertions to the queue that you can use to assert the inverse of these methods:

    use AppJobsProcessPodcast;
     
    $job = (new ProcessPodcast)->withFakeQueueInteractions();
     
    $job->handle();

    $job->assertNotDeleted();
    $job->assertNotFailed();
    $job->assertNotReleased();

    Make Facade::isFake() Public

    Caleb White contributed an update to the isFake() method, making the visibility public:

    use IlluminateSupportFacadesBus;

    Bus::isFake(); // false
    Bus::fake();
    Bus::isFake(); // true

    Release notes

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

    v11.20.0

    Update testcase for whereNone method by @einar-hansen in https://github.com/laravel/framework/pull/52351

    Improve Lock->block method by @RedmarBakker in https://github.com/laravel/framework/pull/52349

    [11.x] Use correct pluralization rules in trans_choice for fallback strings by @stefanvdlugt in https://github.com/laravel/framework/pull/52343

    [11.x] Replace dead link in Security Policy by @Jubeki in https://github.com/laravel/framework/pull/52338

    Add compatible query type to Model::resolveRouteBindingQuery by @sebj54 in https://github.com/laravel/framework/pull/52339

    [10.x] Fix Factory::afterCreating callable argument type by @villfa in https://github.com/laravel/framework/pull/52335

    [11.x] Remove undefined class PreventRequestsDuringMaintenance by @seriquynh in https://github.com/laravel/framework/pull/52322

    [11.x] Add middleware before sending request and dispatching events by @eduance in https://github.com/laravel/framework/pull/52323

    Add collapseWithKeys to Collection by @jasonmccreary in https://github.com/laravel/framework/pull/52347

    [11.x] Inverse Fake Queue Interactions: assertNotDeleted, assertNotFailed, and assertNotReleased by @gdebrauwer in https://github.com/laravel/framework/pull/52320

    Add deduplicate to strings by @jasonmccreary in https://github.com/laravel/framework/pull/52350

    [11.x] feat: make Facade::isFake() public by @calebdw in https://github.com/laravel/framework/pull/52357

    [11.x] Ask about markdown template for notification command with no initial input by @christophrumpel in https://github.com/laravel/framework/pull/52355

    [11.x] allow custom view path when making components by @browner12 in https://github.com/laravel/framework/pull/52219

    [11.x] chore: update to PHPStan Level 1 by @calebdw in https://github.com/laravel/framework/pull/51956

    [11.x] Support passing default as named parameter in whenLoaded, whenAggregated, whenCounted by @hn-seoai in https://github.com/laravel/framework/pull/51342

    Declare exceptions unreportable using the ShouldntReport interface by @chrispage1 in https://github.com/laravel/framework/pull/52337

    [11.x] Enable extension of connection inspection methods by @GromNaN in https://github.com/laravel/framework/pull/52231

    [11.x] Add whenExistsLoaded method to conditionally include relationship existence attribute by @CodeWithKyrian in https://github.com/laravel/framework/pull/52295

    [11.x] Add in() and inHidden() functions to Context Stacks by @lessevv in https://github.com/laravel/framework/pull/52346

    [11.x] Use Command::fail() method for single error messages by @seriquynh in https://github.com/laravel/framework/pull/52387

    [11.x] Rework Context::stackContains with Closures. by @timacdonald in https://github.com/laravel/framework/pull/52381

    [11.x] Allow enums to be passed to AssertableJson where methods by @patrickomeara in https://github.com/laravel/framework/pull/52360

    [11.x] Made list validation rule as array for “size rules” in validation messages by @siarheipashkevich in https://github.com/laravel/framework/pull/52385

    [11.x] Add contextual attributes to resolve drivers by @ziadoz in https://github.com/laravel/framework/pull/52265

    [11.x] Fix docblocks for where(All|Any|None) query methods by @einar-hansen in https://github.com/laravel/framework/pull/52388

    [10.x] backport #52204 by @calebdw in https://github.com/laravel/framework/pull/52389

    [11.x] Fix Http Client Pool requests that have no response by @andrewbroberg in https://github.com/laravel/framework/pull/52393

    [11.x] Introduce MixFileNotFoundException for handling missing Mix files by @Ex10Dios in https://github.com/laravel/framework/pull/52400

    [10.x] In MySQL, harvest last insert ID immediately after query is executed by @piurafunk in https://github.com/laravel/framework/pull/52390

    The post A New String Helper, Assert Enums in AssertableJson, and more in Laravel 11.20 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 ArticleOpenAI adds support for Structured Outputs for JSON in its API
    Next Article Beginner Guide to Total.js UI: #02 Understanding Paths

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 19, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-4915 – PHPGurukul Auto Taxi Stand Management System SQL Injection

    May 19, 2025
    Leave A Reply Cancel Reply

    Hostinger

    Continue Reading

    L’ascesa dei marchi di slot machine nelle sponsorizzazioni sportive globali

    Linux

    Best Free and Open Source Alternatives to Google Analytics

    Linux

    The AI Fix #25: Beware of the superintelligence, and a spam-eating AI super gran

    Development

    How to Create SRT Files for Videos in Node.js

    Artificial Intelligence

    Highlights

    Post Malone The BIG ASS Stadium Tour 2025 Shirt

    November 20, 2024

    Post Content Source: Read More 

    CVE-2025-2765 – CarlinKit CPC200-CCPA Hard-Coded Credentials Authentication Bypass

    April 23, 2025

    I switched to LED lightbulbs to save money, but doing so uncovered 5 other benefits

    February 20, 2025

    Hiding elements that require JavaScript without JavaScript

    April 30, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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