{"id":21084293,"url":"https://github.com/ahmadhuss/laravel-api","last_synced_at":"2026-05-16T23:31:50.914Z","repository":{"id":100760367,"uuid":"370607726","full_name":"ahmadhuss/laravel-api","owner":"ahmadhuss","description":"API inside Laravel","archived":false,"fork":false,"pushed_at":"2021-07-09T05:39:11.000Z","size":1080,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-08T23:02:22.792Z","etag":null,"topics":["api","api-rest","database-server","database-settings","database-tables","laravel"],"latest_commit_sha":null,"homepage":"https://apiweb1.herokuapp.com/","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/ahmadhuss.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":"2021-05-25T07:43:54.000Z","updated_at":"2021-07-09T05:39:14.000Z","dependencies_parsed_at":"2023-06-09T16:15:10.034Z","dependency_job_id":null,"html_url":"https://github.com/ahmadhuss/laravel-api","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Flaravel-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Flaravel-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Flaravel-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmadhuss%2Flaravel-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmadhuss","download_url":"https://codeload.github.com/ahmadhuss/laravel-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243526953,"owners_count":20305115,"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","api-rest","database-server","database-settings","database-tables","laravel"],"created_at":"2024-11-19T20:23:47.695Z","updated_at":"2026-05-16T23:31:45.894Z","avatar_url":"https://github.com/ahmadhuss.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# How can we use this repo?\n\n\n# Install\n```sh\ncomposer install\n```\nNext you can clone the `.env.example` file into the `.env` file. This means that you have to create the same file in the `root` directory under a different name e.g. `.env` and copy paste the same credentials like `.env.example` file.\n\nLaravel has a built-in CLI tool called `artisan`. Your application must generate a unique base 64 key that Laravel uses behind the scenes to bootstrap this project.\n\n**Command:**\n\n```sh\nphp artisan key:generate\n```\n\nIt will automatically find your `.env` file and place the base 64 value in the file.\n\n**Output inside the file:**\n```\nAPP_KEY=base64:T0huMR5Wx9EoDmjTxniKTofHD/7cOiDeVVD9eTKuCa0=\n```\n\n## Additional Note:\nAs you can see it is necessary to create the `.env` file in your local to bootstrap the project. But `Laravel` contains 2 methods to connect to the database server.\n\n- Use of the `.env` variables *(I prefer this one)*\n- Use of the file located at the `config/database.php`\n\n\n\n## Use of the `.env` variables:\n\nWhen you create this file with copy paste credentials you can see default; the database variables are written something like this:\n ```\nDB_CONNECTION=mysql  \nDB_HOST=127.0.0.1  \nDB_PORT=3306  \nDB_DATABASE=test_app  \nDB_USERNAME=root  \nDB_PASSWORD=\n```\n\nYou can edit values according to your own database personal preference. I am using Postgres in this case.\n\n##  Use of the file located at the `config/database.php`\n\n**Note:** When Laravel bootstraps the project it gives priority to the `.env` file as compared to `config/**` files. You can see `config/database.php` file contains an associated array with default database settings like this.\n\n```\nreturn [\n    \n    'default' =\u003e env('DB_CONNECTION', 'mysql'),\n    'connections' =\u003e [\n        'mysql' =\u003e [\n            'driver' =\u003e 'mysql',\n            'url' =\u003e env('DATABASE_URL'),\n            'host' =\u003e env('DB_HOST', '127.0.0.1'),\n            'port' =\u003e env('DB_PORT', '3306'),\n            'database' =\u003e env('DB_DATABASE', 'forge'),\n            'username' =\u003e env('DB_USERNAME', 'forge'),\n            'password' =\u003e env('DB_PASSWORD', ''),\n            'unix_socket' =\u003e env('DB_SOCKET', ''),\n            'charset' =\u003e 'utf8mb4',\n            'collation' =\u003e 'utf8mb4_unicode_ci',\n            'prefix' =\u003e '',\n            'prefix_indexes' =\u003e true,\n            'strict' =\u003e true,\n            'engine' =\u003e null,\n            'options' =\u003e extension_loaded('pdo_mysql') ? array_filter([\n                PDO::MYSQL_ATTR_SSL_CA =\u003e env('MYSQL_ATTR_SSL_CA'),\n            ]) : [],\n        ],\n    ]\n    ]\n```\n\nYou can only use these settings if variables from the `.env` file will be deleted. Otherwise, Laravel gives priority to `.env` variables.\n\nDelete the variables from the `.env`:\n\n\n~~DB_CONNECTION=mysql~~  \n~~DB_HOST=127.0.0.1~~  \n~~DB_PORT=3306~~  \n~~DB_DATABASE=test_app~~  \n~~DB_USERNAME=root~~  \n~~DB_PASSWORD=~~\n\nLastly, Update the `config/database.php` with your database server settings:\n\n```\n'default' =\u003e env('DB_CONNECTION', 'pgsql')\n'database' =\u003e env('DB_DATABASE', 'lara8_api'),\n'username' =\u003e env('DB_USERNAME', 'postgres'),\n'password' =\u003e env('DB_PASSWORD', 'a')\n```\n\n# Database\nI am using  **Postgres** and inside `.env` file my database server credentials are:\n```\nDB_CONNECTION=pgsql\nDB_HOST=127.0.0.1  \nDB_PORT=5432\nDB_DATABASE=lara8_api\nDB_USERNAME=postgres\nDB_PASSWORD=a\n```\n\nHowever, your main server and database server get started.\n\n# Migration (Transform into real database tables)\nAt the last make sure after updating your database settings. Please use `artisan` CLI to migrate the database tables.\n```sh\nphp artisan migrate\n```\n\n\n# Deployment\n[Heroku](https://www.heroku.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadhuss%2Flaravel-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmadhuss%2Flaravel-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmadhuss%2Flaravel-api/lists"}