Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MouadZIANI/laravel-query-inspector
The missing laravel helper that allows you to inspect your eloquent queries with it's bind parameters
https://github.com/MouadZIANI/laravel-query-inspector
eloquent laravel query-builder
Last synced: 3 months ago
JSON representation
The missing laravel helper that allows you to inspect your eloquent queries with it's bind parameters
- Host: GitHub
- URL: https://github.com/MouadZIANI/laravel-query-inspector
- Owner: mouadziani
- License: mit
- Created: 2021-07-14T20:13:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-31T03:50:30.000Z (over 2 years ago)
- Last Synced: 2024-07-20T17:45:09.487Z (4 months ago)
- Topics: eloquent, laravel, query-builder
- Language: PHP
- Homepage:
- Size: 22.5 KB
- Stars: 56
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
- awesome-morocco - laravel-query-inspector - query-inspector.svg?style=social)](https://github.com/MouadZIANI/laravel-query-inspector/stargazers) - The missing laravel helper that allows you to inspect your eloquent queries with it's bind parameters. by [@mouadziani](https://github.com/mouadziani) (Uncategorized / Uncategorized)
README
# Laravel Query Inspector
The missing laravel helper that allows you to ispect your eloquent queries with it's bind parameters## Motivations
Let's say you want to get the generated sql query from an eloquent query, by default in Laravel you can use the ``toSql()`` method, but in some situations you may need to get the generated query with its values instead of just getting the prepared statement, in this case you can use this package as well as a helper which will give you the generated sql query with its bind parameters as a plain sql query just by calling ``toRawSql()`` from any eloquent query.## Installation
You can install the package via composer:
```bash
composer require mouadziani/laravel-query-inspector
```## Usage
```php
// Using toSql()
$query = Model::where('attribute', 'value')->toSql();
dd($query); // select * from models where attribute = ?// Using toRawSql()
$query = Model::where('attribute', 'value')->toRawSql();
dd($query); // select * from models where attribute = 'value'
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [MouadZIANI](https://github.com/mouadziani)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
featured_repository