CI4-Lic is a software license manager modul for Codeigniter 4, connecting to WordPress license server based on the Software License Manager Plugin.

Overview

CI4-Lic

PHP Bootstrap 5 Font Awesome Maintained

CI4-Lic is a software license manager modul for Codeigniter 4, connecting to WordPress license server based on Software License Manager Plugin.

Requirements

  • PHP 7.3+, 8.0+ (Attention: PHP 8.1 not supported yet by CI 4 as of 2022-01-01)
  • CodeIgniter 4.0.4+

Features

  • activate/deactivate a license key
  • register/deregister a domain for a license key
  • display license information

Installation

Install Sofftware License Manager on your WordPress site

I assume that you have a WordPress site installed on which you want to manage your licenses. I recommend to install a separate WordPress instance just for that purpose. Connectivity between your CI4 application and that server is required.

  • Install the Software License Manager Plugin on that server
  • Configure the plugin, e.g. setting the secret key for validation

Install Codeigniter

Install an appstarter project with Codigniter 4 as described here.

Make sure your app and database is configured right and runs fine showing the Codigniter 4 welcome page.

Download CI4-Lic

Download the CI4-Lic archive from this repo here.

Copy CI4-Lic to your ThirdParty folder

Note: CI4-Lic is not available as a Composer package yet. It works from your ThirdParty folder.

Unzip the CI4-Lic archive and copy the 'lewe' directory to your \app\ThirdParty folder in your Codeigniter project. You should see this tree section then:

project-root
- app
  - ThirdParty
    - lewe
      - ci4-lic
        - src

Configuration

  1. Add the Psr4 path in your app/Config/Autoload.php file as follows:
public $psr4 = [
    APP_NAMESPACE  => APPPATH, // For custom app namespace
    'Config'       => APPPATH . 'Config',
    'CI4\Lic'      => APPPATH . 'ThirdParty/lewe/ci4-lic/src',
];
  1. For easier access the the helper functions, add the helper names 'lic' and 'bs5' to your app/Controller/BaseCopntroller.php. It might look like this (do not reomve existing helper entries):
protected $helpers = ['bs5', 'lic', 'session'];
  1. Change the details for your license server and secret key in lewe/ci4-lic/src/Config/Lic.php. Example:
public $licenseServer = 'https://www.mylicenseserver.com';
...
public $secretKey = '5e07r7d791df36.99585318';

Routes

The CI4-Lic routes are defined in lewe/ci4-lic/src/Config/Routes.php. Copy the routes group from there to your app/Config/Routes.php file, right after the 'Route Definitions' header comment.

/*
* --------------------------------------------------------------------
* Route Definitions
* --------------------------------------------------------------------
*/
//
// CI4-Lic Routes
//
$routes->group('', ['namespace' => 'CI4\Lic\Src\Controllers'], function ($routes) {

    $routes->match(['get', 'post'], 'license', 'LicController::index', ['as' => 'license']);
    
    ...

});

Views

The views that come with CI4-Lic are based on Bootstrap 5 and Font Awesome 5.

If you like to use your own view you can override them editing the $views array in lewe/ci4-lic/src/Config/Lic.php:

public $views = [

    'license'   => 'CI4\Lic\Views\license',

];

Database

This library does not need any database records. However, you may want to save the license key in a database at a later point.

Currently, this library uses a hard-coded key for testing purposes in the readKey() function of the license controller. Replace that code for reading the key from your database when you're ready. lewe/ci4-lic/src/Controllers/LicController.php:

// ------------------------------------------------------------------------
/**
 * Reads the license key from the database.
 */
function readKey()
{
    //
    // Most probably your license key will be in your database together with
    // other settings of your application. Add the proper code to read it
    // here e.g. from a database with this pseudo code
    // $this->key = read_key_from_db();
    //
    $this->key = 'CI4-1781ydy363738';
}

For saving a license key in your database, use the saveKey() function of the license controller. Add your code there. lewe/ci4-lic/src/Controllers/LicController.php:

// ------------------------------------------------------------------------
/**
 * Saves the license key to the database.
 * 
 * @param string $value The license key
 */
function saveKey($value)
{
    //
    // You may want to use this method to save the license key elsewhere
    // e.g. to a database with this pseudo code
    // save_key_to_db($this->key);
    //
}

Run Application

Start your browser and navigate to your public directory. Use the menu to check out the views that come with CI4-Lic.

Helper Functions (Lic)

In addition to the helper functions that come with Myth-Auth, CI4-Lic provides these:

dnd()

  • Function: Dump'n'Die. Returns a preformatted output of objects and variables.
  • Parameters: Variable/Object, Switch to die after output or not
  • Returns: Preformatted output

Helper Functions (Bootstrap 5)

In order to create Bootstrap objects quicker and to avoid duplicating code in views, these helper functions are provided:

bs5_alert()

  • Function: Creates a Bootstrap 5 alert box.
  • Parameters: Array with alert box details.
  • Returns: HTML

bs5_cardheader()

  • Function: Creates a Bootstrap card header.
  • Parameters: Array with card header details.
  • Returns: HTML

bs5_formrow()

  • Function: Creates a two-column form field div (text, email, select, password).
  • Parameters: Array with form field details.
  • Returns: HTML

bs5_modal()

  • Function: Creates a modal dialog.
  • Parameters: Array with modal dialog details.
  • Returns: HTML

bs5_searchform()

  • Function: Creates a search form field.
  • Parameters: Array with search form details.
  • Returns: HTML

bs5_toast()

  • Function: Creates a Bootstrap toast.
  • Parameters: Array with toast details.
  • Returns: HTML

Disclaimer

The CI4-Lic library is not perfect. It may very well contain bugs or things that can be done better. If you stumble upon such things, let me know. Otherwise I hope the library will help you. Feel free to change anything to meet the requirements in your environment.

Enjoy, George Lewe

You might also like...
A learning management system (LMS) is a software application or web-based technology used to plan, implement and assess a specific learning process.

vidyaprabodhan-gov-php-project A learning management system (LMS) is a software application or web-based technology used to plan, implement and assess

Task Manager is a Task Management Module/Tools for wordpress

Task Manager is a Task Management Module/Tools for wordpress, where you can create, manage, assign user, update and delete different tasks. It has all features of Task Management Application.

PHP web based Password Manager for business and personal use.

sysPass - Systems Password Manager Join us in the Gitter chat room: PHP web based Password Manager for business and personal use. AES-256 encryption i

Web based groupware server written in PHP
Web based groupware server written in PHP

EGroupware Tools Usage runs unit-tests after each commit scrutinizer runs static analysis on our codebase manual testing with unusual browser versions

This is a plugin written in PHP programming language and running on the PocketMine platform that works stably on the API 4.0.0 platform. It allows you to query some other server information
This is a plugin written in PHP programming language and running on the PocketMine platform that works stably on the API 4.0.0 platform. It allows you to query some other server information

QueryServer This is a plugin written in PHP programming language and running on the PocketMine platform that works stably on the API 4.0.0 platform. I

A plugin to restore the Classic Widgets in WordPress.

=== Classic Widgets === Contributors: wordpressdotorg, hellofromtonya, azaozz Tags: gutenberg, disable, disable gutenberg, editor, classic widgets Req

:panda_face: Jitamin is a free software written in PHP, intended to handle the project management over the web. QQ群: 656868

Jitamin Jitamin (pronounced /ˈdʒɪtəmɪn/) is a free software written in PHP, intended to handle the project management over the web. Jitamin is inspire

Kanban project management software

Kanboard Kanboard is project management software that focuses on the Kanban methodology. Official website: https://kanboard.org/ List of features Chan

FreeBSD Bhyve Web Administration Software
FreeBSD Bhyve Web Administration Software

BVCP is a graphical and secure webcontrol panel for FreeBSD Bhyve's Virtual Machines. BVCP is made with love and for enterprise use, 24/7 NON-STOP operation, tested on production enterprise-class area.

Releases(v1.0.0-beta)
Owner
George Lewe
George Lewe
Open Source Point of Sale is a web based point of sale application written in PHP using CodeIgniter framework.

Open Source Point of Sale is a web based point of sale application written in PHP using CodeIgniter framework. It uses MySQL as the data back end and has a Bootstrap 3 based user interface.

opensourcepos 2.7k Jan 2, 2023
TinyFileManager is web based file manager and it is a simple, fast and small file manager with a single file, multi-language ready web application

TinyFileManager is web based file manager and it is a simple, fast and small file manager with a single file, multi-language ready web application for storing, uploading, editing and managing files and folders online via web browser. The Application runs on PHP 5.5+, It allows the creation of multiple users and each user can have its own directory and a build-in support for managing text files with cloud9 IDE and it supports syntax highlighting for over 150+ languages and over 35+ themes.

Prasath Mani 3.5k Jan 7, 2023
Official Coding Standards for CodeIgniter

CodeIgniter Coding Standard This library holds the official coding standards of CodeIgniter based on PHP CS Fixer and powered by Nexus CS Config. Inst

CodeIgniter 37 Dec 19, 2022
Integration of the popular Bootstrap CSS framework for CodeIgniter 4

Tatter\Bootstrap Integration of the popular Bootstrap CSS framework for CodeIgniter 4 Description This library leverages Tatter\Assets to automate ass

Tatter Software 1 Nov 27, 2021
Persistent user-specific settings for CodeIgniter 4

Tatter\Preferences Persistent user-specific settings for CodeIgniter 4 Quick Start Install with Composer: > composer require --dev tatter/preferences

Tatter Software 5 May 6, 2022
Customer Relationship Management (CRM) portal using PHP Codeigniter 4 & Tailwind CSS framework.

CRM Portal Customer Relationship Management (CRM) portal using PHP Codeigniter 4 & Tailwind CSS framework. Screenshots User (Dashboard) Admin (Employe

Dawood Khan Masood 5 Feb 2, 2022
ZAP CRM is Customer Relationship Management portal built using PHP Codeigniter 4 & Tailwind CSS framework.

ZAP CRM ZAP CRM is Customer Relationship Management portal built using PHP Codeigniter 4 & Tailwind CSS framework. Screenshots User (Dashboard) Admin

Dawood Khan Masood 5 Feb 2, 2022
NamelessMC is a free, easy to use & powerful website software for your Minecraft server

NamelessMC - v2 pre-release 10 NamelessMC is a free, easy to use & powerful website software for your Minecraft server, which includes a large range o

NamelessMC 520 Jan 1, 2023
flare Manager .flare framework Manager

flare-Manager flare Manager .flare framework Manager Welcome to the flare-Manager install Flare form https://github.com/flare-framework/Flare move ind

Flare framework 1 Aug 14, 2022
Server manager is a open source project made for people so that they can add the servers to one single place irrespective of their provider and manage it through one location.

Server Manager Are you sick of having to log into hundreads of different website just to access your server? Well we got you, Server manager is a open

null 8 Aug 9, 2022