Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Inputbag Laravel Package

jaikumar0101/laravel-inputbag

Fluent builder to standardize Laravel request inputs for search, pagination, and sorting. Provides sensible defaults, configurable global settings, and custom field mappings so controllers stay clean and API responses remain consistent (array or collection output).

View on GitHub
Deep Wiki
Context7
v1.0.5

Now you can add custom keys in configuration that will be populated with default standard values

v1.0.4

This resolve the $request method when making new input

v1.0.3

First final release after testing

v1.0.2

Fixed the Service provider issue

v1.0.1

Service provider bug fixed

v1.0.0

🎉 Laravel InputBag v1.0.0 - Initial Release

We're excited to announce the first stable release of Laravel InputBag - a fluent builder for standardizing request inputs in Laravel applications!

🚀 What is Laravel InputBag?

Laravel InputBag simplifies handling common API request parameters like search, pagination, and sorting. Instead of writing repetitive code in every controller, use our fluent builder to standardize your input processing.

✨ Key Features

📋 Standard Input Processing

Automatically handles common request parameters:

  • search - Search query
  • page - Current page number
  • per_page - Items per page
  • sort_by - Sort column
  • order_by - Sort direction

🎯 Fluent API

Clean, readable method chaining:

$inputs = InputBag::standard()->toArray();

🔧 Custom Field Mapping

Easily map custom request fields:

$inputs = InputBag::set('category', 'category_id')
    ->set('status', 'filter_status', 'active')
    ->set('min_price', 'price_min', 0)
    ->standard()
    ->toCollection();

⚙️ Configurable Defaults

Customize default values via config file:

'defaults' => [
    'per_page' => 15,
    'sort_by' => 'id',
    'order_by' => 'desc',
]

📦 Installation

composer require jaikumar0101/laravel-inputbag

Optionally publish the config:

php artisan vendor:publish --tag="inputbag-config"

💡 Quick Example

Before:

public function index(Request $request)
{
    $search = $request->input('search');
    $page = $request->input('page', 1);
    $perPage = $request->input('per_page', 15);
    $sortBy = $request->input('sort_by', 'id');
    $orderBy = $request->input('order_by', 'desc');
    
    // ... your query logic
}

After:

public function index()
{
    $inputs = InputBag::standard()->toArray();
    
    $products = Product::when($inputs['search'], fn($q) => 
                    $q->where('name', 'like', '%' . $inputs['search'] . '%'))
                ->orderBy($inputs['sort_by'], $inputs['order_by'])
                ->paginate($inputs['per_page']);
                
    return response()->json($products);
}

📚 Documentation

Full documentation is available in the [README.md](https://github.com/jaikumar0101/laravel-inputbag#readme)

🎯 Requirements

  • PHP 8.1+
  • Laravel 10.x or 11.x

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

MIT License - see [LICENSE.md](LICENSE.md) for details

🙏 Acknowledgments

Thank you to everyone who provided feedback and suggestions during development!


What's Next?

  • Share your feedback and feature requests
  • Star the repository if you find it useful
  • Report any issues you encounter

Happy coding! 🎊


Made with ❤️ by [Jai Kumar](https://github.com/jaikumar0101)

Full Changelog: https://github.com/Jaikumar0101/laravel-input-bag-request/commits/v1.0.0

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle