{"id":42202606,"url":"https://github.com/squareboat/laravel-boilerplate","last_synced_at":"2026-01-27T00:28:12.048Z","repository":{"id":293947890,"uuid":"954510118","full_name":"squareboat/laravel-boilerplate","owner":"squareboat","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-10T18:44:49.000Z","size":460,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T12:26:06.837Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/squareboat.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}},"created_at":"2025-03-25T07:37:23.000Z","updated_at":"2025-07-10T18:44:53.000Z","dependencies_parsed_at":"2025-05-18T05:42:15.046Z","dependency_job_id":null,"html_url":"https://github.com/squareboat/laravel-boilerplate","commit_stats":null,"previous_names":["squareboat/laravel-boilerplate"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/squareboat/laravel-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareboat%2Flaravel-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareboat%2Flaravel-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareboat%2Flaravel-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareboat%2Flaravel-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squareboat","download_url":"https://codeload.github.com/squareboat/laravel-boilerplate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squareboat%2Flaravel-boilerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28793124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-27T00:28:11.942Z","updated_at":"2026-01-27T00:28:12.019Z","avatar_url":"https://github.com/squareboat.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ca href=\"https://laravel.com\" target=\"_blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg\" width=\"400\" alt=\"Laravel Logo\"\u003e\u003c/a\u003e\u003c/p\u003e\n\n# Laravel Boilerplate for Squareboat\n\nThis repository provides a robust Laravel 11 boilerplate that standardizes project setups for our organization. It comes preconfigured with several key features and integrations to help you hit the ground running.\n\n## Table of Contents\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Environment Configuration](#environment-configuration)\n- [Project Structure](#project-structure)\n- [Integrated Functionalities](#integrated-functionalities)\n- [Authentication \u0026 Authorization](#authentication--authorization)\n- [API Routing \u0026 Documentation](#api-routing--documentation)\n- [Service-Repository Pattern](#service-repository-pattern)\n- [Social Authentication (Google Login)](#social-authentication-google-login)\n- [Error Monitoring with Sentry](#error-monitoring-with-sentry)\n- [Running the Application](#running-the-application)\n- [Testing](#testing)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\n- **Authentication \u0026 Authorization:**\n  - API authentication via Laravel Sanctum\n  - Role-based access control using Spatie Laravel Permission\n\n- **API Routing:**\n  - Custom Route Service Provider with global prefix (e.g. `/api/v1`)\n\n- **Documentation:**\n  - Swagger/OpenAPI integration (via DarkaOnLine/L5-Swagger)\n\n- **Social Authentication:**\n  - Google login integration using Laravel Socialite\n\n- **Error Monitoring:**\n  - Sentry integration for real-time error logging and monitoring\n\n- **Service-Repository Pattern:**\n  - Clean separation of business logic (services) and data access (repositories)\n\n- **Telescope for development environment:**\n  - Telescope is already present for the developement environment so that you can check everything with the help of UI \n\n## Requirements\n\n- **PHP:** \u003e= 8.0\n- **Composer**\n- **Node.js \u0026 npm:** For asset compilation\n- **Database:** MySQL or any supported database\n- **Redis:** (Optional) For queues and caching if you later integrate queue monitoring\n\n## Installation\n\n1. **Clone the Repository:**\n```bash\ngit clone \u003cyour-repo-url\u003e\ncd laravel_boiler_plate\n```\n\n2. **Install Composer Dependencies:**\n```bash\ncomposer install\n```\n\n3. **Install Node Dependencies:**\n```bash\nnpm install\n```\n\n4. **Copy the Environment File and Generate an Application Key:**\n```bash\ncp .env.example .env\nphp artisan key:generate\n```\n\n5. **Run Migrations (and Seed, if applicable):**\n```bash\nphp artisan migrate\nphp artisan db:seed --class=RolesAndPermissionsSeeder\n```\n\n6. **Compile Frontend Assets:**\n```bash\nnpm run dev\n```\n\n## Environment Configuration\n\nIn your .env file, configure the following (update values as needed):\n\n```dotenv\n# Application\nAPP_NAME=\"Laravel Boilerplate\"\nAPP_ENV=local\nAPP_DEBUG=true\nAPP_URL=http://localhost:8000\n\n# Database\nDB_CONNECTION=mysql\nDB_HOST=127.0.0.1\nDB_PORT=3306\nDB_DATABASE=boilerplate_db\nDB_USERNAME=root\nDB_PASSWORD=your_password\n\n# API Authentication (Sanctum)\nSANCTUM_STATEFUL_DOMAINS=localhost\nSESSION_DOMAIN=localhost\n\n# Social Authentication (Google)\nGOOGLE_CLIENT_ID=your-google-client-id\nGOOGLE_CLIENT_SECRET=your-google-client-secret\nGOOGLE_REDIRECT_URI=http://localhost:8000/auth/google/callback\n\n# Sentry Error Monitoring\nSENTRY_LARAVEL_DSN=https://YOUR_PUBLIC_KEY@o0.ingest.sentry.io/YOUR_PROJECT_ID\n\n# Swagger Documentation (optional settings)\nL5_SWAGGER_GENERATE_ALWAYS=true\n```\n\nAfter modifying the .env file, clear your configuration cache:\n```bash\nphp artisan config:clear\n```\n\n## Project Structure\n\nA few key directories:\n\n- **app/Http/Controllers:** Contains your application controllers (including Auth, SocialAuthController, etc.)\n- **app/Repositories:** Contains repository interfaces and implementations\n- **app/Services:** Contains service classes that encapsulate business logic\n- **app/Swagger:** Contains dummy classes (e.g., OpenApiDefinition.php) anchoring global Swagger annotations\n- **routes/web.php \u0026 routes/api.php:** Define your web and API routes\n- **config/:** Contains configuration files for Sanctum, Sentry, L5-Swagger, etc.\n\n## Integrated Functionalities\n\n### Authentication \u0026 Authorization\n\n- **API Authentication:**\n  Laravel Sanctum is used for token-based API authentication.\n\n- **Role-Based Access Control:**\n  Spatie Laravel Permission is installed. The User model uses the HasRoles trait:\n  ```php\n  use Spatie\\Permission\\Traits\\HasRoles;\n  \n  class User extends Authenticatable\n  {\n      use HasApiTokens, HasRoles, Notifiable;\n  }\n  ```\n\n### API Routing \u0026 Documentation\n\n- **Routing:**\n  A custom Route Service Provider prefixes all API routes with /api/v1.\n  Example in app/Providers/RouteServiceProvider.php:\n  ```php\n  protected function mapApiRoutes()\n  {\n      Route::prefix('api/v1')\n          -\u003emiddleware('api')\n          -\u003egroup(base_path('routes/api.php'));\n  }\n  ```\n\n- **Swagger Documentation:**\n  Swagger is integrated using DarkaOnLine/L5-Swagger.\n  Global annotations are anchored in a dummy class:\n  ```php\n  \u003c?php\n  \n  namespace App\\Swagger;\n  \n  /**\n   * @OA\\Info(\n   *   title=\"Laravel Boilerplate API\",\n   *   version=\"1.0.0\",\n   *   description=\"This is the API documentation for the Laravel Boilerplate.\",\n   *   @OA\\Contact(email=\"support@example.com\"),\n   *   @OA\\License(name=\"MIT\", url=\"https://opensource.org/licenses/MIT\")\n   * )\n   */\n  class OpenApiDefinition\n  {\n      // Dummy class for Swagger global annotations.\n  }\n  ```\n\n  Generate docs with:\n  ```bash\n  php artisan l5-swagger:generate\n  ```\n  And access them at: http://localhost:8000/api/documentation\n\n### Service-Repository Pattern\n\n- **Repository Interface \u0026 Implementation:**\n  Define repository interfaces (e.g., UserRepositoryInterface) and concrete classes (e.g., UserRepository) in app/Repositories.\n\n- **Service Layer:**\n  Services (in app/Services) encapsulate business logic and interact with repositories.\n\n- **Binding:**\n  Bind interfaces to implementations in app/Providers/AppServiceProvider.php:\n  ```php\n  public function register()\n  {\n      $this-\u003eapp-\u003ebind(\n          \\App\\Repositories\\UserRepositoryInterface::class,\n          \\App\\Repositories\\UserRepository::class\n      );\n  }\n  ```\n\n### Social Authentication (Google Login)\n\n- **Laravel Socialite:**\n  Installed via:\n  ```bash\n  composer require laravel/socialite\n  ```\n\n- **Configuration:**\n  Add provider settings in config/services.php and set environment variables as shown in the Environment Configuration section.\n\n- **Controller:**\n  A SocialAuthController handles redirection and callback:\n  ```php\n  \u003c?php\n  \n  namespace App\\Http\\Controllers\\Auth;\n  \n  use App\\Http\\Controllers\\Controller;\n  use Illuminate\\Http\\Request;\n  use Socialite;\n  use App\\Models\\User;\n  use Illuminate\\Support\\Facades\\Auth;\n  use Illuminate\\Support\\Str;\n  \n  class SocialAuthController extends Controller\n  {\n      public function redirectToProvider($provider)\n      {\n          // Use the \"web\" middleware to ensure sessions are available\n          return Socialite::driver($provider)-\u003eredirect();\n      }\n  \n      public function handleProviderCallback($provider)\n      {\n          try {\n              $socialUser = Socialite::driver($provider)-\u003estateless()-\u003euser();\n          } catch (\\Exception $e) {\n              return redirect('/login')-\u003ewithErrors('Unable to login using ' . $provider . '. Please try again.');\n          }\n  \n          $user = User::firstOrCreate(\n              ['email' =\u003e $socialUser-\u003egetEmail()],\n              [\n                  'name' =\u003e $socialUser-\u003egetName() ?? $socialUser-\u003egetNickname() ?? 'No Name',\n                  'password' =\u003e bcrypt(Str::random(16))\n              ]\n          );\n  \n          Auth::login($user, true);\n          return redirect()-\u003eintended('/');\n      }\n  }\n  ```\n\n- **Routes:**\n  Define social authentication routes in routes/web.php (ensure these are within the \"web\" middleware group):\n  ```php\n  use App\\Http\\Controllers\\Auth\\SocialAuthController;\n  \n  Route::middleware(['web'])-\u003egroup(function () {\n      Route::get('auth/{provider}', [SocialAuthController::class, 'redirectToProvider'])\n          -\u003ename('social.redirect');\n      Route::get('auth/{provider}/callback', [SocialAuthController::class, 'handleProviderCallback'])\n          -\u003ename('social.callback');\n  });\n  ```\n\n### Error Monitoring with Sentry\n\n- **Installation:**\n  ```bash\n  composer require sentry/sentry-laravel\n  php artisan vendor:publish --provider=\"Sentry\\Laravel\\ServiceProvider\"\n  ```\n\n- **Configuration:**\n  Set your DSN in the .env file (see Environment Configuration). Sentry will automatically capture exceptions and performance issues.\n\n## Running the Application\n\n1. **Serve the Application:**\n   ```bash\n   php artisan serve\n   ```\n   The app will be available at http://localhost:8000.\n\n2. **Testing Endpoints:**\n   - Use Postman or cURL to test API endpoints (e.g., authentication, user endpoints)\n   - Access Swagger UI at: http://localhost:8000/api/documentation\n   - For Google login, visit: http://localhost:8000/auth/google\n\n3. **Error Testing:**\n   - Trigger an error (e.g., visit a test route) to ensure Sentry logs it\n\n## Testing\n\n- **Automated Testing:**\n  Write tests using PHPUnit (or Pest) in the tests/ directory.\n\n- **Run Tests:**\n  ```bash\n  php artisan test\n  ```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request with improvements or bug fixes. Follow our coding standards and add tests when applicable.\n\n## License\n\nThis project is open-sourced under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquareboat%2Flaravel-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquareboat%2Flaravel-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquareboat%2Flaravel-boilerplate/lists"}