{"id":30180768,"url":"https://github.com/codewithathis/xml2json-employeeapi","last_synced_at":"2026-06-17T23:31:28.014Z","repository":{"id":257214839,"uuid":"857626797","full_name":"codewithathis/XML2JSON-EmployeeAPI","owner":"codewithathis","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-15T07:50:44.000Z","size":920,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T12:05:57.741Z","etag":null,"topics":["codeigniter","php"],"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/codewithathis.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}},"created_at":"2024-09-15T06:53:31.000Z","updated_at":"2024-09-22T07:23:02.000Z","dependencies_parsed_at":"2024-09-15T10:48:32.568Z","dependency_job_id":"fd84e0bc-16ea-4b8f-8b6a-fd520de0e8a3","html_url":"https://github.com/codewithathis/XML2JSON-EmployeeAPI","commit_stats":null,"previous_names":["athis97/xml2json-employeeapi","codewithathis/xml2json-employeeapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codewithathis/XML2JSON-EmployeeAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithathis%2FXML2JSON-EmployeeAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithathis%2FXML2JSON-EmployeeAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithathis%2FXML2JSON-EmployeeAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithathis%2FXML2JSON-EmployeeAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codewithathis","download_url":"https://codeload.github.com/codewithathis/XML2JSON-EmployeeAPI/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codewithathis%2FXML2JSON-EmployeeAPI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270024697,"owners_count":24514054,"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","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"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":["codeigniter","php"],"created_at":"2025-08-12T08:01:58.032Z","updated_at":"2026-06-17T23:31:27.986Z","avatar_url":"https://github.com/codewithathis.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# CodeIgniter 4 Application for Employee Management \u0026 XML Data Handling\n\n## Overview\nThis is a simple CodeIgniter 4 application that provides the following functionalities:\n\n- **Employee Registration** with token generation and storage.\n- **Token-based Authentication API** to fetch employee data.\n- **XML File Upload and Parsing**:\n  - Converts XML data into JSON format.\n  - Stores the JSON data in the database.\n  - Displays the stored JSON data.\n\n## Features\n\n### Employee Registration:\n- User registration with form validation (client \u0026 server-side).\n- Each registered employee is assigned a unique token.\n\n### Token-based API:\n- API to fetch employee data by employee ID and token.\n\n### XML Handling:\n- Upload an XML file, parse it, convert to JSON, and store it in the database.\n- View the stored XML data in JSON format.\n\n## Prerequisites\n- PHP \u003e= 7.4\n- Composer\n- CodeIgniter 4.x\n- MySQL or SQLite for database\n\n## Installation\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/Athis97/XML2JSON-EmployeeAPI.git\n    cd XML2JSON-EmployeeAPI\n    ```\n\n2. Install dependencies:\n\n    ```bash\n    composer install\n    ```\n\n3. Copy the `.env.example` to `.env`:\n\n    ```bash\n    cp env.example .env\n    ```\n\n4. Update your `.env` file with the database credentials:\n\n    ```env\n    database.default.hostname = localhost\n    database.default.database = your_database_name\n    database.default.username = your_db_username\n    database.default.password = your_db_password\n    database.default.DBDriver = MySQL\n    ```\n\n5. Migrate the database to create the required tables:\n\n    ```bash\n    php spark migrate\n    ```\n\n6. Start the development server:\n\n    ```bash\n    php spark serve\n    ```\n\n   The application should now be running at [http://localhost:8080](http://localhost:8080).\n\n## Folder Structure\n\n### Controllers:\n- `EmployeeController.php`: Handles employee registration and form submission.\n- `VehAvailController.php`: Manages XML data upload, conversion, and storage.\n- `ApiController.php`: Provides the token-based employee data retrieval API.\n\n### Models:\n- `Employee.php`: Defines the employee model.\n- `VehAvail.php`: Defines the XML data model.\n\n### Views:\n- `employee_register.php`: Registration form.\n- `employee_success.php`: Success message after employee registration.\n- `upload_xml.php`: XML upload form.\n- `veh_avail_view.php`: Displays stored JSON data.\n\n## Routes\n\n```php\n$routes-\u003eget('/', 'Home::index');\n$routes-\u003eget('employee/register', 'EmployeeController::register');\n$routes-\u003epost('employee/save', 'EmployeeController::save');\n$routes-\u003eget('employee/success', 'EmployeeController::success');\n$routes-\u003eget('veh-avail/show', 'VehAvailController::showData');\n$routes-\u003eget('veh-avail/upload', 'VehAvailController::uploadXmlForm');\n$routes-\u003epost('veh-avail/import', 'VehAvailController::importXml');\n\n// API routes\n$routes-\u003eget('api/employee', 'ApiController::getEmployee');\n```\n\n## API Documentation\n\n### Get Employee Data:\n- **URL**: `GET /api/employee`\n- **Parameters**:\n  - `token` (required): The employeeâ€™s unique token.\n  - `id` (required): Employee ID.\n- **Response**: JSON containing employee data or error message.\n\n#### Example API Request\n\n```http\nGET /api/employee?token=abc123\u0026id=1\nContent-Type: application/json\n```\n\n#### Response:\n\n```json\n{\n    \"id\": 1,\n    \"name\": \"John Doe\",\n    \"email\": \"johndoe@example.com\",\n    \"token\": \"abc123\"\n}\n```\n\n## XML Upload Example\n\nTo upload XML and convert it to JSON:\n\n1. Go to [http://localhost:8080/veh-avail/upload](http://localhost:8080/veh-avail/upload).\n2. Select the XML file and click upload.\n3. Data will be saved in JSON format and can be viewed at [http://localhost:8080/veh-avail/show](http://localhost:8080/veh-avail/show).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithathis%2Fxml2json-employeeapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithathis%2Fxml2json-employeeapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithathis%2Fxml2json-employeeapi/lists"}