Welcome Guest, Not a member yet? Register   Sign In
add on system codeigniter 4
#1

how can i make add-on / plugins system in codeigniter 4 can someone please give me a reference?
Reply
#2

(This post was last modified: 07-20-2022, 11:31 AM by captain-sensible.)

well lets take your terminology of plugin , something i might have heard concerning WordPress to mean "how can I extend functionality"?

So lets say you want to include the functionality of a spam checker ; it will check input from a form to see if the user of the form is a spammer. I can only give you mu approach. So the way i went about it is to write a php class; but it won't be a controller.

So to make it easy to be found I create a directory called "Andy" inside the codeigniter4 "app" directory.

Inside the class at the start i write :
Code:
<?php namespace App\Andy;




class CheckSpam
{


inside my class "CheckSpam" keeping it simple i declare an array of usual suspect spam key words eg containing 'free consultation','Toenail Clippers',


to use my class its just a case of getting an instance of it and passing data to one of its methods . basically text from a submitted form will be run through , using each key word in my array. Sounds slow and tedious but works a treat. Anybody that wants to test it live let me know

So its just like a plugin for say wordpress , but i have gone about it using a class.


With a class you can just about do anything ; also a class have have several methods which each do something different
CMS CI4     I use Arch Linux by the way 

Reply




Theme © iAndrew 2016 - Forum software by © MyBB