peekphp / peek
A package to ask any AI Client to give detailed answer of improvements on PHP files/snippets.
Requires
- php: ^8.3.0
- guzzlehttp/guzzle: ^7.0
- symfony/console: ^7.2
Requires (Dev)
- laravel/pint: ^1.18.1
- mockery/mockery: ^1.6
- pestphp/pest: ^3.5.1
- pestphp/pest-plugin-type-coverage: ^3.1
- phpstan/phpstan: ^1.12.7
- rector/rector: ^1.2.8
- symfony/var-dumper: ^7.1.6
This package is auto-updated.
Last update: 2025-06-29 02:09:46 UTC
README
Peek is a lightweight and powerful PHP package that integrates with any AI Client to provide detailed insights, improvements, and optimization suggestions for your PHP files and code snippets.
Requires PHP 8.3+
✨ Key Features
- 🧠 Analyze PHP files or snippets with DeepSeek for actionable improvement suggestions.
- 🔍 Spot inefficiencies, errors, and optimization opportunities in your codebase.
- ⚡ Easily integrate into your existing workflows via a command-line interface.
🚀 Installation
Install Peek using Composer:
composer require peekphp/peek
⚙️ Usage
Analyze a PHP File
Run the peek
command to analyze an entire PHP file:
vendor/bin/peek peek path/to/your/file.php
Analyze a Code Snippet
Specify a line range within a file to analyze just a part of your code:
vendor/bin/peek peek path/to/your/file.php --lines=10:20
Example Output:
Analyzing the file: path/to/your/file.php Suggestions: 1. Add strict types to improve type safety. 2. Replace deprecated function `md5()` with a modern hashing algorithm like `password_hash()`. 3. Optimize nested loops for better performance.
🔧 Configuration
To set up Peek in your project, use the init
command:
vendor/bin/peek init
This will generate a peek.json configuration file in your project's root directory, allowing you to define client settings such as API key, URL, and model.
Example peek.json:
{ "client": { "key": "your-api-key", "url": "https://api.example.com", "model": "gpt-4" } }
🤦🏻 Run Tests
Run the complete test suite using PHPUnit:
composer test
Peek comes with both unit and integration tests to ensure its reliability.
🤝 Contributing
Contributions are welcome! Feel free to submit issues or pull requests to help make Peek even better.
Steps to Contribute:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your feature description"
- Push to your branch:
git push origin feature/your-feature-name
- Submit a pull request.
We appreciate your contributions! ❤️
📚 License
Peek is open-source software licensed under the MIT License.
Crafted with ❤️ by Doekos