amicrud/search

Search for a method, class, or variable in the project using artisan command
238 1
Install
composer require amicrud/search
Latest Version:v1.1.51
PHP:>=7.4
License:MIT
Last Updated:Jun 30, 2026
Links: GitHub  ·  Packagist
Maintainer: focuslegon

AmiCrud Search

Search for classes, methods, variables, Blade views, and frontend UI code from an Artisan command.

Features

  • Search across common Laravel and PHP project files.
  • Supports Blade, PHP, JavaScript, TypeScript, Vue, CSS, JSON, YAML, Markdown, XML, and env files by default.
  • Works with Inertia applications where UI code lives in resources/js.
  • Excludes vendor, storage, node_modules, .git, and generated build folders by default.
  • Can optionally replace matched text in all matched files.
  • Built with command, action, service, and DTO layers for maintainable package code.

Installation

You can install the package via Composer. Run the following command in your Laravel project:


composer require amicrud/search

Usage

Basic Usage

php artisan amicrud:search UserController

Use quotes when searching strings with spaces:

php artisan amicrud:search 'Create Account'

Search A Specific Path

php artisan amicrud:search Dashboard --path=resources/js

Include Vendor Or Storage

php artisan amicrud:search SomeClass --vendor
php artisan amicrud:search failed-job --storage

Search Specific Extensions

php artisan amicrud:search Dashboard --extensions=js,jsx,ts,tsx,vue

Replace Matches

php artisan amicrud:search oldName --replace=newName

Replacement runs once per matched file and updates every occurrence of the keyword in that file.

Testing

Run the test suite with Composer:

composer test

The tests cover searching backend PHP files, Blade views, Inertia frontend files in resources/js, excluded directories, custom extensions, and replacement behavior.

Releasing

If the latest GitHub tag is v1.1.30, the next feature release should be:

git add .gitignore README.md composer.json phpunit.xml src tests
git commit -m "Improve project search architecture"
git tag v1.2.0
git push origin main
git push origin v1.2.0

Use a patch tag such as v1.1.31 only for small bug fixes. Use a minor tag such as v1.2.0 when adding new behavior, like frontend file searching or a new test suite.

Testing

Run the test suite with Composer:

composer test

Run the suite with a text coverage report:

composer test:coverage

Publishing A Release

Create a GitHub repository, then connect and push this package:

git init
git add .
git commit -m "Initial release"
git branch -M main
git remote add origin git@github.com:YOUR_USERNAME/search.git
git push -u origin main

Create and push a version tag:

git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0

For future releases, commit your changes, then create a new semantic version tag such as v1.0.1, v1.1.0, or v2.0.0.

Contributing

Contributions are welcome. Please follow these steps before opening a pull request:

  1. Fork the repository.
  2. Clone your fork locally.
  3. Create a new branch for your change.
  4. Install dependencies with Composer.
  5. Make your changes.
  6. Add or update tests for any behavior you change.
  7. Run the test suite.
  8. Open a pull request into the main branch.
git clone git@github.com:YOUR_USERNAME/search.git
cd search
composer install
git checkout -b feature/your-change
composer test

Keep pull requests focused, describe what changed, and include any relevant test details.

Support

If you encounter any problems or have questions, please open an issue on the GitHub repository.

License

The AmiCrud package is open-sourced software licensed under the MIT license.