PHPackages                             languaojs/viperphp - 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. languaojs/viperphp

ActiveProject[Framework](/categories/framework)

languaojs/viperphp
==================

A PHP Framework

v0.1.4(5mo ago)00MITPHPPHP &gt;=8.0

Since Jan 13Pushed 5mo agoCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

ViperPHP Framework `v0.1.4`
===========================

[](#viperphp-framework-v014)

ViperPHP is a lightweight, easy-to-use, and secure PHP framework designed for rapid development. It features a clean structure, a built-in CLI tool, and a flexible asset management system.

🚀 Installation
--------------

[](#-installation)

Install ViperPHP using Composer:

```
composer create-project languaojs/viperphp your-app-name
```

This should be followed by:

```
composer update
```

And

```
composer dump-autoload
```

Then, go to `config/Config.php` and set your base URL (e.g., ). Run XAMPP or WAMP, the go to your app URL.

🛠 Getting Started
-----------------

[](#-getting-started)

### 1. The Home Page

[](#1-the-home-page)

To edit the main landing page, go to:

```
app/Views/home/index.php

```

### 2. The Navigation Menu

[](#2-the-navigation-menu)

To edit the global navbar, go to:

```
app/Views/partials/home-menu.php

```

### 3. Configuration

[](#3-configuration)

To set your App Name, Security Keys, or Database Credentials, open:

```
config/Config.php

```

📄 Creating a New Page
---------------------

[](#-creating-a-new-page)

To create a new page (e.g., About), follow these steps:

### 1. Create a Controller:

[](#1-create-a-controller)

Open your terminal and type:

```
php craft make:controller About
```

Alternatively, manually create `app/Controllers/About.php`.

### 2. Set up the logic

[](#2-set-up-the-logic)

Inside your new controller, ensure you have an `index()` method. You can copy the structure from `Home.php`.

### 3. Create the view

[](#3-create-the-view)

- Create a folder: `app/Views/about/`
- Create a file: `app/Views/about/index.php`

### 4. Connect Controller to a view

[](#4-connect-controller-to-a-view)

In your About.php controller, update the view call:

```
$this->view('about/index');
```

🎨 Asset Management (CSS &amp; JS)
---------------------------------

[](#-asset-management-css--js)

ViperPHP uses a unique method to register and load assets, allowing you to load only what you need per page.

### Registering Assets

[](#registering-assets)

Go to `app/Libraries/Assets.php` to register your files. You can use local files or CDN links:

- Place local files in public/assets/css/ or public/assets/js/.
- Register them in the `Assets.php` library.
- Set Default Assets in this file to load them on every page automatically.

### Loading Assets in the Controller

[](#loading-assets-in-the-controller)

You can determine which assets load for a specific method directly in the controller.

🖼 Media &amp; Images
--------------------

[](#-media--images)

All images and media files should be placed in public/media/.

### Retrieving Media

[](#retrieving-media)

Use the `get_media($path)` helper function to generate the correct URL. This function supports subfolders and filenames. Example Usage:

```
