PHPackages                             snugphp/starter - 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. [Framework](/categories/framework)
4. /
5. snugphp/starter

ActiveProject[Framework](/categories/framework)

snugphp/starter
===============

A simple PHP framework

v1.0.0(4mo ago)01MITCSSPHP &gt;=7.4

Since Jan 3Pushed 4mo agoCompare

[ Source](https://github.com/Rabbi728/snugPHP)[ Packagist](https://packagist.org/packages/snugphp/starter)[ RSS](/packages/snugphp-starter/feed)WikiDiscussions master Synced 1mo ago

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

snugPHP Starter
===============

[](#snugphp-starter)

> A lightweight, fast, and elegant PHP framework starter kit for modern web development.

[![PHP Version](https://camo.githubusercontent.com/6eff5053a32c9e0bcc0982c4f118ef689cad7831a3d982767aae3901bf67313c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253345253344372e342d626c75652e737667)](https://php.net)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

🚀 Overview
----------

[](#-overview)

**snugPHP Starter** is the boilerplate for creating applications with the **snugPHP** framework. It provides the essential directory structure and configuration to get you started immediately.

### Why snugPHP?

[](#why-snugphp)

- ⚡ **Lightning Fast** - Minimal overhead, maximum performance
- 🎯 **Auto Routing** - Convention over configuration
- 🔧 **Query Builder** - Elegant database operations without models
- 🛠️ **Rich Helpers** - 50+ helper functions for common tasks
- 🔌 **Middleware Support** - Secure and modular request handling
- 📦 **Zero Bloat** - Only what you need, nothing more

---

📁 Directory Structure
---------------------

[](#-directory-structure)

```
your-project/
├── index.php              # Application entry point
├── .env                   # Environment variables
├── composer.json          # Dependencies & autoloading
│
├── app/                   # Your application code
│   ├── config/            # Configuration files
│   │   ├── database.php   # Database configuration
│   │   └── app.php        # App settings
│   ├── controllers/       # Controller classes
│   │   ├── HomeController.php
│   │   └── ...
│   ├── middlewares/       # Middleware classes
│   │   └── AuthMiddleware.php
│   ├── views/             # Views & Layouts
│   │   ├── layouts/       # Master layouts
│   │   └── pages/         # Page templates
│   │       ├── home.php
│   │       └── ...
│   └── route.php          # Manual route definitions
│
├── assets/                # Static files
│   ├── css/
│   ├── js/
│   └── images/
│
└── vendor/                # Composer dependencies (includes framework core)

```

---

🔧 Installation
--------------

[](#-installation)

To create a new project using snugPHP:

```
composer create-project snugphp/starter my-project
```

### Requirements

[](#requirements)

- PHP &gt;= 7.4
- MySQL/MariaDB
- Apache/Nginx with mod\_rewrite enabled
- Composer

### Quick Start

[](#quick-start)

1. **Navigate to your project directory**:

    ```
    cd my-project
    ```
2. **Configure Environment**:

    The installation should have created a `.env` file from `.env.example`. If not, copy it manually:

    ```
    cp .env.example .env
    ```

    Update `.env` with your database credentials.
3. **Start development server**:

    ```
    php -S localhost:8000
    ```

    Visit `http://localhost:8000` in your browser.

---

🎯 Routing
---------

[](#-routing)

snugPHP supports both **manual routing** and **automatic routing**.

### Auto Routing

[](#auto-routing)

When `APP_AUTO_ROUTING` is enabled in `.env` (or config), URLs automatically map to controllers:

**URL Pattern:** `/controller/method/param1/param2`

```
/                       → HomeController->index()
/user/index             → UserController->index()
/user/show/123          → UserController->show(123)
/user/delete/123        → UserController->delete(123)

```

### Manual Routing

[](#manual-routing)

Define custom routes in `app/route.php`:

```
use Core\Router;

$router = new Router();

$router->get('/', function() {
    view('home');
});

$router->get('/user/index', [UserController::class, 'index']);
$router->post('/user/store', [UserController::class, 'store']);
$router->delete('/user/delete/{id}', [UserController::class, 'delete']);

return $router;
```

---

🎮 Controllers
-------------

[](#-controllers)

Create controllers in `app/controllers/`.

```
namespace App\Controllers;

class UserController {
    public function index() {
        $users = db('users')->get();
        view('users/index', ['users' => $users]);
    }

    public function store() {
        $user = db('users')->insert([
            'name' => 'John Doe',
            'email' => 'john@example.com',
            'password' => 'password',
        ]);
    }

    public function delete($id) {
        db('users')->where('id', $id)->delete();
    }
}
```

---

🗄️ Database
-----------

[](#️-database)

Access the database using the global `db()` helper.

```
// Select
$users = db('users')->where('status', 'active')->get();

// Insert
$id = db('users')->insert(['name' => 'John', 'email' => 'john@example.com']);

// Update
db('users')->where('id', 1)->update(['name' => 'Jane']);

// Delete
db('users')->where('id', 1)->delete();
```

---

👁️ Views
--------

[](#️-views)

Views are located in `app/views/pages/` and layouts in `app/views/layouts/`.

```
// Render 'app/views/pages/home.php'
view('home', ['title' => 'Welcome']);
```

---

❓ Help
------

[](#-help)

For more detailed documentation, check the core framework repository or the helper functions available in `vendor/snugphp/framework`.

📚 Best Practices
----------------

[](#-best-practices)

### Controller Guidelines

[](#controller-guidelines)

- Keep controllers thin
- Use meaningful method names
- Return early for invalid input
- Use helper functions

### Database Guidelines

[](#database-guidelines)

- Always use query builder or prepared statements
- Index frequently queried columns
- Use transactions for multiple operations
- Close connections when done

### Security Guidelines

[](#security-guidelines)

- Validate all user input
- Escape output in views
- Use CSRF protection
- Never trust user input
- Keep framework updated

### Performance Tips

[](#performance-tips)

- Enable OPcache in production
- Use database indexing
- Minimize database queries
- Cache frequently accessed data
- Optimize images and assets

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please follow these guidelines:

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Write tests if applicable
5. Submit a pull request

---

📄 License
---------

[](#-license)

snugPHP is open-source software licensed under the [MIT license](LICENSE).

---

💬 Support
---------

[](#-support)

- **Documentation:**
- **Issues:**
- **Email:**

---

🎉 Credits
---------

[](#-credits)

Created with ❤️ by the snugPHP Team

**Built for developers who value:**

- Speed over complexity
- Simplicity over bloat
- Productivity over configuration

---

**Happy coding with snugPHP! 🚀**

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance75

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

135d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0a1606ed65bc711a55fadde591dd402ddf2d45e73bdd588ada60dc138ba23b6f?d=identicon)[Rabbi](/maintainers/Rabbi)

---

Top Contributors

[![Rabbi728](https://avatars.githubusercontent.com/u/50083657?v=4)](https://github.com/Rabbi728 "Rabbi728 (11 commits)")

### Embed Badge

![Health badge](/badges/snugphp-starter/health.svg)

```
[![Health](https://phpackages.com/badges/snugphp-starter/health.svg)](https://phpackages.com/packages/snugphp-starter)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
