PHPackages                             softigital-dev/core - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. softigital-dev/core

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

softigital-dev/core
===================

some of our usefull things that is needed in any laravel project

v1.0.9(3mo ago)08MITPHPPHP ^8.2CI passing

Since Feb 15Pushed 3mo agoCompare

[ Source](https://github.com/softigital-dev/core)[ Packagist](https://packagist.org/packages/softigital-dev/core)[ RSS](/packages/softigital-dev-core/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

Softigital Core
===============

[](#softigital-core)

**A powerful Laravel package for rapid API development with authentication, code generators, and smart middleware.**

Streamline your Laravel projects with pre-built authentication components, Google OAuth integration, standardized API responses, and intelligent code generators that follow best practices.

[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![Laravel Version](https://camo.githubusercontent.com/5c5576721d3a9233c218b8d6db0f2ea626aee0ab821ffd60b59a9e1d0e942daa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31312532422d7265642e737667)](https://laravel.com)

---

📑 Table of Contents
-------------------

[](#-table-of-contents)

- [Overview](#-overview)
- [Requirements](#-requirements)
- [Installation](#-installation)
- [Quick Start Guide](#-quick-start-guide)
- [Commands Reference](#-commands-reference)
    - [Installation Commands](#installation-commands)
    - [Generator Commands](#generator-commands)
- [Middleware](#-middleware)
- [API Response Utility](#-api-response-utility)
- [Usage Examples](#-usage-examples)
- [Configuration](#-configuration)
- [Testing](#-testing)
- [Security](#-security)
- [Contributing](#-contributing)
- [License](#-license)

---

🎯 Overview
----------

[](#-overview)

Softigital Core is designed to eliminate repetitive boilerplate code and accelerate Laravel API development. Install complete authentication systems with a single command, generate well-structured services and routes instantly, and enjoy auto-configured middleware that just works.

**Key Features:**

- 🔐 Complete authentication system (register, login, profile)
- 🌐 Google OAuth integration with ID token verification
- 📦 Standardized JSON response formatting
- 🛡️ Smart middleware (auto-applied JSON responses, optional auth)
- 🎨 Code generators for CRUD, routes, and services
- 📂 Automatic API route structure (v1 versioning)
- ⚡ One-command CRUD generation (model, migration, controller, service, requests, resource, routes)
- ⚙️ Fully configurable via published config file

---

📋 Requirements
--------------

[](#-requirements)

- **PHP**: 8.2 or higher
- **Laravel**: 11.0 or higher
- **Laravel Sanctum**: For token-based authentication

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require softigital-dev/core
```

The service provider registers automatically via Laravel's package auto-discovery.

### Optional: Publish Configuration

[](#optional-publish-configuration)

To customize middleware behavior:

```
php artisan vendor:publish --tag=softigital-config
```

This creates `config/softigital-core.php` for middleware configuration.

---

🚀 Quick Start Guide
-------------------

[](#-quick-start-guide)

### 1. Install Base Setup (Recommended First Step)

[](#1-install-base-setup-recommended-first-step)

Set up the foundational API structure:

```
php artisan softigital:install base
```

**What you get:**

- routes/v1/api.php structure
- bootstrap/app.php configured for v1 routing
- ApiResponse utility for standardized responses

### 2. Install Authentication (Optional)

[](#2-install-authentication-optional)

Add a complete authentication system:

```
php artisan softigital:install auth
```

**What you get:**

- Login endpoint (`POST /api/v1/auth/login`)
- Register endpoint (`POST /api/v1/auth/register`)
- Profile endpoint (`GET /api/v1/auth/me`)
- Complete controllers, services, requests, and routes

### 3. Generate Additional Resources

[](#3-generate-additional-resources)

Create a full CRUD API in seconds:

```
# Create complete CRUD structure for a model
php artisan make:crud Post

# Or create individual components:

# Create route file with API resource routes
php artisan make:route posts --controller=PostController --api

# Generate service with repository pattern
php artisan make:service Post --model=Post --repository
```

### 4. Start Using

[](#4-start-using)

Your API is ready! The middleware automatically handles JSON responses.

```
# Test the registration endpoint
curl -X POST http://localhost/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"name":"John","email":"john@example.com","password":"secret123"}'
```

---

📚 Commands Reference
--------------------

[](#-commands-reference)

### Installation Commands

[](#installation-commands)

#### `softigital:install {type}`

[](#softigitalinstall-type)

Install pre-built authentication components.

**Available Types:**

TypeDescriptionWhat Gets Installed`base`Base API setuproutes/v1 structure, bootstrap/app.php config, ApiResponse utility`auth`Basic authenticationAuthController, AuthService, LoginRequest, RegisterRequest, routes`google-auth`Google OAuthGoogleAuthController, GoogleLoginRequest, google config, migration, google/apiclient package**Options:**

- `--force` : Overwrite existing files without prompting
- `--skip-migration` : Skip migration publishing and execution (google-auth only)
- `--skip-composer` : Skip composer package installation

**Examples:**

```
# Install base setup (recommended first step)
php artisan softigital:install base

# Install basic authentication
php artisan softigital:install auth

# Install Google OAuth with force overwrite
php artisan softigital:install google-auth --force

# Install without running migrations
php artisan softigital:install google-auth --skip-migration

# Display help
php artisan softigital:install --help
```

**After installing Google auth, configure `.env`:**

```
GOOGLE_CLIENT_ID=your-client-id-here
GOOGLE_CLIENT_SECRET=your-client-secret-here
GOOGLE_REDIRECT_URI=your-redirect-uri-here
```

---

### Generator Commands

[](#generator-commands)

#### `make:route {name}`

[](#makeroute-name)

Create a new route file in `routes/v1/` with automatic registration.

**Options:**

- `--controller=Name` : Specify controller and import it
- `--resource` : Generate full resourceful routes (index, create, store, show, edit, update, destroy)
- `--api` : Generate API resource routes (excludes create, edit)

**Examples:**

```
# Basic route file
php artisan make:route posts

# With controller
php artisan make:route posts --controller=PostController

# API resource routes (recommended for APIs)
php artisan make:route posts --controller=PostController --api

# Full resource routes
php artisan make:route products --controller=ProductController --resource
```

**Generated file (`routes/v1/posts.php`):**

```
