sherifsheremetaj / cars
Cars information package
v1.6
2025-02-28 09:21 UTC
Requires
- ext-simplexml: *
- illuminate/support: ^11.43
Requires (Dev)
- laravel/pint: ^1.21
- orchestra/testbench: ^9.10
- phpunit/phpunit: ^11.5
README
A simple PHP package for managing car manufacturers' data in multiple formats (JSON, CSV, XML). Supports data retrieval, conversion, and validation with robust error handling.
📦 Installation
Install the package via Composer:
composer require sherifsheremetaj/cars
🚀 Usage
1️⃣ Retrieve Manufacturers
use SherifSheremetaj\Cars\Enums\DataTypes; use SherifSheremetaj\Cars\Manufactures; #JSON data $manufactures = new Manufactures(); $data = $manufactures->getManufactures(DataTypes::JSON); echo $data . PHP_EOL; #CSV data $manufactures = new Manufactures(); $data = $manufactures->getManufactures(DataTypes::CSV); echo $data . PHP_EOL; #XML data $manufactures = new Manufactures(); $data = $manufactures->getManufactures(DataTypes::XML); echo $data . PHP_EOL;
1️⃣ Retrieve CarTypes
use SherifSheremetaj\Cars\CarTypes; use SherifSheremetaj\Cars\Enums\DataTypes; #JSON data $carTypes = new CarTypes(); $data = $carTypes->getTypes(DataTypes::JSON); echo $data; #CSV data $carTypes = new CarTypes(); $data = $carTypes->getTypes(DataTypes::CSV); echo $data; #XML data $carTypes = new CarTypes(); $data = $carTypes->getTypes(DataTypes::XML); echo $data;
🛠 Configuration
By default, data is loaded from:
__DIR__ . '/data/....';
✅ Running Tests
To run the PHPUnit test suite, use:
composer install vendor/bin/phpunit
To run lint (Laravel pint), use
composer pint
🔍 Data Source
Logo images are crawled from Carlogos.org and processed for optimal usage.
📝 Contributing
Pull requests are welcome! To contribute:
- Fork the repository.
- Create a new feature branch (
git checkout -b feature-name
). - Commit your changes (
git commit -m "Added feature X"
). - Push to the branch (
git push origin feature-name
). - Open a pull request.
📜 License
This package is licensed under the MIT License.
⭐ Support & Feedback
If you find this package helpful, please ⭐ star the repository! For suggestions or issues, open an issue.
Made with ❤️ by Sherif Sheremetaj