StubHub is a Laravel application designed to streamline the process of generating JSON stubs for REST API testing. This tool provides robust features, including flexible stub generation, sample data seeding, and customizable constraints, making it ideal for developers and testers working with RESTful APIs.
- JSON Stub Generation: Quickly create JSON stubs with various data types, including personal information, addresses, payment details, and more.
- Sample Data Seeder: Populate your application with realistic test data for endpoints, users, and more.
- Custom Policies and Constraints: Manage API stub sizes, endpoint limits, and user roles with built-in policies.
- Category-Based Data Mapping: Generate stubs based on predefined categories like Internet, Payment, Address, and Personal Info.
- PHP: 8.3+
- pre-commit
-
Clone the repository:
git clone https://github.com/GitHamo/StubHub.git cd StubHub
-
Install dependencies:
composer install npm install
-
Set up your environment:
- Copy
.env.example
to.env
:cp .env.example .env
- Configure your database and other environment variables in
.env
.
- Copy
-
Run migrations and seeders:
php artisan migrate --seed
-
Start the development server:
php artisan serve
- Access the application at
http://localhost:8000
. - Use the provided endpoints and interface to create, manage, and test JSON stubs.
- Customize your stubs by modifying
StubFieldContextMapper
and other related classes.
-
StubFieldContextMapper: Centralized mapping of data categories, input types, and case methods for stub generation.
- Categories include:
- Personal Info: Full name, email, phone numbers, etc.
- Address: City, country, postal code, etc.
- Internet: URLs, IP addresses, MIME types, etc.
- Payment: Credit card details, IBANs, etc.
- Input types such as text, numbers, and booleans are defined for flexibility.
- Categories include:
-
Policies:
UserPolicy
enforces user roles and constraints for creating and deleting endpoints.EndpointPolicy
manages endpoint ownership and deletion rights.
-
Seeders:
DatabaseSeeder
initializes the database with default admin and user roles.SampledataSeeder
andSampledataWithHamSeeder
populate realistic test data for local environments.
We welcome contributions! Please follow these steps:
- Fork the repository.
- Create a feature branch.
- Commit your changes and submit a pull request.
This project is licensed under the MIT License.