{"id":31282100,"url":"https://github.com/jan-krcal/rest-api-example","last_synced_at":"2026-05-04T09:31:55.507Z","repository":{"id":316226278,"uuid":"1061881040","full_name":"jan-krcal/rest-api-example","owner":"jan-krcal","description":"REST API Example (ORM, Apitte, Codeception, Redis, Elasticsearh, RabbitMQ, Nette)","archived":false,"fork":false,"pushed_at":"2025-09-23T10:37:02.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-23T12:34:46.381Z","etag":null,"topics":["apitte","codeception","elasticsearch","jwt","nette","orm","php","rabbitmq","redis"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jan-krcal.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-22T14:05:55.000Z","updated_at":"2025-09-23T10:37:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"222890a2-a6e2-4135-ba62-eaac5f4d75c2","html_url":"https://github.com/jan-krcal/rest-api-example","commit_stats":null,"previous_names":["jan-krcal/rest-api-example"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/jan-krcal/rest-api-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jan-krcal%2Frest-api-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jan-krcal%2Frest-api-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jan-krcal%2Frest-api-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jan-krcal%2Frest-api-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jan-krcal","download_url":"https://codeload.github.com/jan-krcal/rest-api-example/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jan-krcal%2Frest-api-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32601509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"online","status_checked_at":"2026-05-04T02:00:06.625Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apitte","codeception","elasticsearch","jwt","nette","orm","php","rabbitmq","redis"],"created_at":"2025-09-24T03:22:09.954Z","updated_at":"2026-05-04T09:31:55.492Z","avatar_url":"https://github.com/jan-krcal.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"REST API Example (ORM, Apitte, Codeception, Redis, Elasticsearh, RabbitMQ, Nette)\n=================\n\nSample REST API for working with two entities — **articles** and **users**, with authorization support.\n\n## 🐳 Docker Setup\n\nThis project uses the following basic environment setup:\n\n- **PHP 8.2 CLI** with extensions: `bcmath`, `sockets`, `mysqli`\n- MySQL 8.0 database with user, password, and database name as defined in `docker-compose.yml`\n\nFor detailed configuration, please see the `Dockerfile` and `docker-compose.yml` files.\n\n### Important\n\nIf you are **not running the project via Docker**, you need to configure your environment to match these settings as closely as possible. This includes:\n\n- Installing the required PHP version and extensions\n- Setting up a MySQL 8.0 database\n- Mounting or placing project files in the correct path\n\nAdditionally, **you might need to adjust URLs or paths in tests** to reflect your local environment if it differs from the Docker setup.\n\nKeeping environments aligned ensures consistent behavior and successful test runs.\n\n## ⚙️ Installed Extensions and Framework\n\nThis project runs on the **Nette Framework** and uses the following key Composer packages:\n\n## Installed Packages\n\n| Package                               | Purpose                                  |\n|---------------------------------------|-----------------------------------------|\n| `codeception/codeception`             | Testing framework (dev)                 |\n| `codeception/module-asserts`         | Codeception module for assertions (dev) |\n| `codeception/module-phpbrowser`       | Codeception module for browser testing (dev) |\n| `codeception/module-rest`             | Codeception module for REST API testing (dev) |\n| `contributte/apitte`                  | API framework integration               |\n| `contributte/console`                 | Console commands integration            |\n| `elastic/elasticsearch`               | Elasticsearch client                     |\n| `firebase/php-jwt`                     | JWT (JSON Web Token) authentication     |\n| `nettrine/migrations`                  | Database migrations support             |\n| `nettrine/orm`                         | ORM integration for Nette               |\n| `php-amqplib/php-amqplib`              | AMQP (RabbitMQ) client                   |\n| `predis/predis`                        | Redis client                             |\n\n\n\n## 🚀 Startup Instructions\n\n1. **Clone the repository:**\n\n```bash\ngit clone https://github.com/jan-krcal/rest-api-example.git\n```\n\n2. **Install dependencies using Composer:**\n\n```bash\ncomposer install\n```\n\n3. **Start the Docker containers:**\n\n```bash\ndocker-compose up --build\n```\n\n4. **Check and run migrations:**\n\n```bash\nphp bin/console.php migrations:status\nphp bin/console.php migrations:migrate -n\n```\n\n## ✅ Tests\n\nThe project contains tests.\n\n**Run tests with:**\n\n```bash\nphp vendor/bin/codecept run\n```\n\n**List of tests**\n\n| Path                     | Testing framework | Description                                                                                      |\n|--------------------------|-----------------|------------------------------------------------------------------------------------------------|\n| `tests/EmailTest.php`     | Unit Test       | ValueObject                                                |\n| `tests/AuthCest.php`      | API Test        | Tests authentication endpoints (login, registration, token validation)                        |\n| `tests/OpenApiCest.php`   | API Test        | Tests OpenAPI endpoints                                      |\n\n\n## 🧹 Code Quality and Static Analysis\n\n```bash\nphp vendor/bin/phpcbf  --standard=PSR12 \u003cpath\u003e\n```\n\n```bash\nphp vendor/bin/phpstan analyse --memory-limit=512M\n```\n\n## 📚 API Endpoints with Request Body Fields\n\n### Authentication\n\n| Method | Endpoint         | Description                             | Request Body Fields             |\n|--------|------------------|---------------------------------------|--------------------------------|\n| POST   | `/auth/register` | Register a new user                    | `email`, `password`, `role`, `name` |\n| POST   | `/auth/login`    | Login and receive authorization token | `email`, `password`             |\n\n---\n\n### User Management (admin only)\n\n| Method | Endpoint         | Description                           | Request Body Fields                                   |\n|--------|------------------|-------------------------------------|------------------------------------------------------|\n| GET    | `/users`         | List all users                      | —                                                    |\n| GET    | `/users/{id}`    | Get data for a specific user        | —                                                    |\n| POST   | `/users`         | Create a new user                   | `email`, `password`, `role`, `name`                   |\n| PUT    | `/users/{id}`    | Update user data                   | `email` (optional), `name` (optional), `password` (optional), `role` (optional) |\n| DELETE | `/users/{id}`    | Delete a user                      | —                                                    |\n\n---\n\n### Article Management\n\n| Method | Endpoint           | Description                     | Request Body Fields            |\n|--------|--------------------|--------------------------------|-------------------------------|\n| GET    | `/articles`        | List all articles              | —                             |\n| GET    | `/articles/{id}`   | Get article details by ID      | —                             |\n| POST   | `/articles`        | Create an article              | `title`, `content`             |\n| PUT    | `/articles/{id}`   | Update an article              | `title` (optional), `content` (optional) |\n\n---\n\n\n## 📄 License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjan-krcal%2Frest-api-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjan-krcal%2Frest-api-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjan-krcal%2Frest-api-example/lists"}