{"id":24129309,"url":"https://github.com/emmo00/library-management-api","last_synced_at":"2025-10-04T23:26:46.827Z","repository":{"id":255946806,"uuid":"853475356","full_name":"Emmo00/library-management-api","owner":"Emmo00","description":"This is a Library Management API built with Laravel.","archived":false,"fork":false,"pushed_at":"2024-09-08T01:04:53.000Z","size":103,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-11T19:37:17.656Z","etag":null,"topics":["api","laravel","library","sanctum","tests"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Emmo00.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-09-06T18:23:16.000Z","updated_at":"2024-09-08T01:06:30.000Z","dependencies_parsed_at":"2024-09-08T03:23:09.531Z","dependency_job_id":"2eaad7f2-8dc8-45a0-980e-377a32bff69b","html_url":"https://github.com/Emmo00/library-management-api","commit_stats":null,"previous_names":["emmo00/library-management-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmo00%2Flibrary-management-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmo00%2Flibrary-management-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmo00%2Flibrary-management-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Emmo00%2Flibrary-management-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Emmo00","download_url":"https://codeload.github.com/Emmo00/library-management-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241317749,"owners_count":19943212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","laravel","library","sanctum","tests"],"created_at":"2025-01-11T19:31:19.416Z","updated_at":"2025-10-04T23:26:41.786Z","avatar_url":"https://github.com/Emmo00.png","language":"PHP","readme":"# Library Management API\n\nThis is a Library Management API built with Laravel, allowing you to manage books, authors, users, and borrowing records. The API supports user roles such as Admin, Librarian, and Member, with different permissions for each role.\n\n## Features\n\n- **Books:** Create, update, delete, search, borrow, and return books.\n- **Authors:** Manage authors.\n- **Users:** Manage users, with authentication and role-based access control.\n- **Borrow Records:** Manage and track book borrowings.\n- **Authentication:** Token-based authentication using Laravel Sanctum.\n- **Rate Limiting:** Throttled routes to prevent abuse.\n- **Unit Tests:** Unit tests are implemented for each route\n\n## Requirements\n\n- PHP \u003e= 8.0\n- Composer\n- Laravel \u003e= 9.x\n- MySQL or any relational database supported by Laravel\n\n## Setup Instructions\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/Emmo00/library-management-api.git\ncd library-management-api\n```\n\n### 2. Install Dependencies\n\nInstall the PHP dependencies:\n\n```bash\ncomposer install\n```\n\n### 3. Set Up Environment Variables\n\nCreate a `.env` file by copying `.env.example`:\n\n```bash\ncp .env.example .env\n```\n\nUpdate the following settings in the `.env` file:\n\n```bash\nDB_CONNECTION=mysql\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_DATABASE=your_database_name\nDB_USERNAME=your_database_user\nDB_PASSWORD=your_database_password\n\nSANCTUM_STATEFUL_DOMAINS=\"localhost\"\nSESSION_DOMAIN=\"localhost\"\n```\n\n### 4. Generate Application Key\n\n```bash\nphp artisan key:generate\n```\n\n### 5. Run Migrations and Seed the Database\n\nRun the database migrations:\n\n```bash\nphp artisan migrate:fresh\n```\n\n### 6. Serve the Application Locally\n\n```bash\nphp artisan serve\n```\n\nThe application will now be running at `http://127.0.0.1:8000`.\n\n### 7. Running Tests\n\nTo run the feature and unit tests for your application:\n\n```bash\nphp artisan test\n```\n\n## API Endpoints\n\nHere is an overview of the available API endpoints.\n\n### Authentication\n\n- **POST** `/login`: Authenticate a user and retrieve a Sanctum token.\n\n### Books\n\n- **GET** `/books`: Retrieve a list of all books.\n- **GET** `/books/search`: Search for books by title, author, or ISBN.\n- **GET** `/books/{id}`: Retrieve details of a specific book.\n- **POST** `/books`: Create a new book (Admin/Librarian only).\n- **PUT** `/books/{id}`: Update an existing book (Admin/Librarian only).\n- **DELETE** `/books/{id}`: Delete a book (Admin only).\n- **POST** `/books/{id}/borrow`: Borrow a book (Member only, if available).\n- **POST** `/books/{id}/return`: Return a borrowed book (Member only).\n\n### Authors\n\n- **GET** `/authors`: Retrieve a list of all authors.\n- **GET** `/authors/{id}`: Retrieve details of a specific author.\n- **POST** `/authors`: Create a new author (Admin/Librarian only).\n- **PUT** `/authors/{id}`: Update an author (Admin/Librarian only).\n- **DELETE** `/authors/{id}`: Delete an author (Admin only).\n\n### Users\n\n- **GET** `/users`: Retrieve a list of users (Admin only).\n- **GET** `/users/{id}`: Retrieve details of a specific user (Admin only).\n- **POST** `/users`: Register a new user.\n- **PUT** `/users/{id}`: Update user details (Admin only or self).\n- **DELETE** `/users/{id}`: Delete a user (Admin only).\n\n- **POST** `/create-librarian`: Register a new (Librarian) user.\n\n### Borrow Records\n\n- **GET** `/borrow-records`: Retrieve all borrow records (Admin/Librarian only).\n- **GET** `/borrow-records/{id}`: Retrieve details of a specific borrow record (Admin/Librarian only).\n\n### Roles and Permissions\n\nThe application uses role-based access control with the following roles:\n- **Admin:** Full access to manage books, authors, users, and borrow records.\n- **Librarian:** Can manage books, authors, and borrow records.\n- **Member:** Can borrow and return books, view personal details.\n\n## Contribution Guidelines\n\nFeel free to submit a pull request or open an issue for any bug fixes or feature requests.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmo00%2Flibrary-management-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femmo00%2Flibrary-management-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femmo00%2Flibrary-management-api/lists"}