PHPackages                             phphelper/phphelper - 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. phphelper/phphelper

ActiveLibrary[Framework](/categories/framework)

phphelper/phphelper
===================

This is a simpler helpers classes to create a better web application using php. This is intentend to be use for devlopment only for learning purpose using xampp or others. This provides routing,data passing, separation of code using mvc pattern. This is not optmize for production level. Its only for beginner who don't want to use library like laravel or etc

v3.3.3(1y ago)036PHP

Since Aug 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Santoshkurmi/phpbare)[ Packagist](https://packagist.org/packages/phphelper/phphelper)[ RSS](/packages/phphelper-phphelper/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (1)Versions (12)Used By (0)

This is a php library as a lightweight tool to create web application
=====================================================================

[](#this-is-a-php-library--as-a-lightweight-tool-to-create-web-application)

This library is available in composer that can be installed using composer.

```
composer require phphelper/phphelper
```

This library name is `phphelper`

- This can be used for creating web application having routing,controller,middleware,mysql database,request,response handling,authenciation in better way.
- It is created only for learning purpose only. It is useful for people who don't want to use library like laravel as it is complex for beginner.
- It has only 4 to 5 helper classes that help in performing routing,controller,request,response,session and cooking handling.

So only use it if you want to create web application having backend php but don't want to use heavy library and also don't want to use core php only as it has lot of boiler code.

Installation
============

[](#installation)

```
composer require phphelper/phphelper
```

Guide
=====

[](#guide)

- To use this library, you need to setup autoloader using composer. Make sure you have composer and php installed in your system.
- Also for routing, you have to setup your backend server to route all the request to a specific file let say index.php

In this tutorial, I am going to use xampp server for doing that.

Routing setup in xampp
----------------------

[](#routing-setup-in-xampp)

To make sure routing to work, you have to command the apache server of xampp to redirect all the request to a specific php file. Let say the entry point to be 'index.php'

Also, allow the public/ folder to access the resource directly as they may contian css,js,images static assets.

To do that, you can use this code and paste it in the root directory of xampp i.e htdocs/here

- Crete a file in htdocs/.htaccess and paste the following in it.

```

    RewriteEngine On

    # If the requested file or directory exists, serve it directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

      # If the request is for the public directory, serve it directly
    RewriteCond %{REQUEST_URI} !^/public/

    # Otherwise, forward the request to index.php
    RewriteRule ^(.*)$ index.php [L,QSA]

```

This will make xampp server i.e apache to redirect all requests to index.php except from the /public/ folder.

Autoloader setup
================

[](#autoloader-setup)

To setup autoloder, type the following command.

```
composer dump-autoload
```

You can first create composer project using composer init or something. Watch youtube for how to create composer project and autoloader.

Index.php file
==============

[](#indexphp-file)

Install the phphelper from the above guide Add following content in index.php.

```
