Welcome Guest, Not a member yet? Register   Sign In
  Best Way to Implement Affiliate Link Tracking in CodeIgniter 4?
Posted by: kushitha - 06-26-2025, 12:29 AM - Replies (3)

I’m building a lightweight affiliate system using CodeIgniter 4, where users can generate and share unique referral links—similar to how GrabCash manages its Profit Links system.
I want to track the following data:

  • Clicks on each referral link
  • Source of traffic (e.g., WhatsApp, Instagram, etc.)
  • Basic analytics like IP address, timestamp, and referral ID
What’s the most efficient way to implement this in CodeIgniter without causing performance issues?
Should I handle it via middleware or use a dedicated controller for tracking logic?
Also, are there any best practices to prevent bot/fake clicks and ensure more accurate tracking?
Thanks in advance for your suggestions!


  After GIT Clone: Call to a member function routes() on null
Posted by: elbambolo - 06-25-2025, 03:46 AM - Replies (2)

Good morning,

I have a problem that I can neither solve nor understand:
Let me explain better:

I develop locally, I see the site with php spark serve. everything is perfect.
I do git clone on a remote machine.
I then run composer install and then composer update to install and update all the dependencies.

Of course I go to update app.baseURL with the address of the remote machine, but I get the error:

Call to a member function routes() on null

The first thing that comes to mind is the shield. So I go to check if the shield is installed correctly.

After doing this, I am completely blocked and I don't know what else to check.

CodeIgniter v4.6.1 Command Line Tool - Server Time: 2025-06-25 12:44:13 UTC+02:00

[Error]
Call to a member function routes() on null
at APPPATH/Config/Routes.php:262

Line 262:

Code:
service('auth')->routes($routes, ['except' => ['login', 'register', 'apiCitta']]);
$routes->get('login', '\App\Controllers\UserController::loginView');
$routes->post('login', '\CodeIgniter\Shield\Controllers\LoginController::loginAction');


Composer show:

Code:
bacon/bacon-qr-code                v3.0.1  BaconQrCode is a QR code generator for PHP.
codeigniter4/framework            v4.6.1  The CodeIgniter framework v4
codeigniter4/settings              v2.2.0  Settings library for CodeIgniter 4
codeigniter4/shield                v1.1.0  Authentication and Authorization for CodeIgniter 4
dasprid/enum                      1.0.6  PHP 7.1 enum implementation
endroid/qr-code                    6.0.8  Endroid QR Code
fakerphp/faker                    v1.24.1 Faker is a PHP library that generates fake data for you.
firebase/php-jwt                  v6.11.1 A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.
laminas/laminas-escaper            2.17.0  Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs
mikey179/vfsstream                v1.6.12 Virtual file system to mock the real file system in unit tests.
myclabs/deep-copy                  1.13.1  Create deep copies (clones) of your objects
nikic/php-parser                  v5.5.0  A PHP parser written in PHP
paragonie/constant_time_encoding  v3.0.0  Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)
phar-io/manifest                  2.0.4  Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                    3.2.1  Library for handling version information and constraints
phpunit/php-code-coverage          10.1.16 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          4.1.0  FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                4.0.0  Invoke callables with a timeout
phpunit/php-text-template          3.0.1  Simple template engine.
phpunit/php-timer                  6.0.0  Utility class for timing
phpunit/phpunit                    10.5.47 The PHP Unit Testing framework.
psr/clock                          1.0.0  Common interface for reading the clock.
psr/container                      2.0.2  Common Container Interface (PHP FIG PSR-11)
psr/log                            3.0.2  Common interface for logging libraries
sebastian/cli-parser              2.0.1  Library for parsing CLI options
sebastian/code-unit                2.0.0  Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup 3.0.0  Looks up which function or method a line of code belongs to
sebastian/comparator              5.0.3  Provides the functionality to compare PHP values for equality
sebastian/complexity              3.2.0  Library for calculating the complexity of PHP code units
sebastian/diff                    5.1.1  Diff implementation
sebastian/environment              6.1.0  Provides functionality to handle HHVM/PHP environments
sebastian/exporter                5.1.2  Provides the functionality to export PHP variables for visualization
sebastian/global-state            6.0.2  Snapshotting of global state
sebastian/lines-of-code            2.0.2  Library for counting the lines of code in PHP source code
sebastian/object-enumerator        5.0.0  Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector        3.0.0  Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context        5.0.0  Provides functionality to recursively process PHP variables
sebastian/type                    4.0.0  Collection of value objects that represent the types of the PHP type system
sebastian/version                  4.0.1  Library that helps with managing the version number of Git-hosted PHP projects
setasign/fpdf                      1.8.6  FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
spomky-labs/otphp                  11.3.0  A PHP library for generating one time passwords according to RFC 4226 (HOTP Algorithm) and the RFC 6238 (TOTP Algorithm) and compatible with Google Authenticator
symfony/deprecation-contracts      v3.6.0  A generic function and convention to trigger deprecation notices
theseer/tokenizer                  1.2.3  A small library for converting tokenized PHP source code into XML and potentially other formats


  Looking to get back into Codeigniter
Posted by: victorius - 06-24-2025, 09:23 AM - Replies (1)

Hi peeps, just wanted to say hi, because I'm so happy to rediscover CodeIgniter.

Loved CodeIgniter back in the day, although I did not do anything big or advanced with it.

CodeIgniter 4 is looking great and it's still so fast and straightforward.

Professionally (and personally) I've mostly used Joomla! and WordPress for years and years. Magento as well (up to version 2).

Other than development, I've been a ecommerce-/marketing manager for years as well.

As an old school dev, I really don't want to learn how to create Gutenberg blocks etc. I never had the time or a reason to become a javascript wiz or learn React.

Although I will probably try Vue.js with CodeIgniter for fun.

I was a big CMS and framework nerd back in the day. Had to try almost everything Smile

CMS's are great, especially for when multiple people are working on content. But for personal projects their structure can be a pain. I'm so used to fight WordPress that when using CodeIgniter I have to remind myself that it's OK to do things like I want.

Although both WordPress and Joomla! have CLI, task managers etc. Joomla! is probably my #1 (version 5 is really good and the code is modern), but the implicit demand and awareness from clients is WordPress.

As for the short term with CodeIgniter:

  • Go through a bunch of tutorials / buy books or courses (if any)
  • Create a few personal projects:
  • As mentioned above, something that uses vue.js (admin of some sort/web app)
  • API integrations
  • Probably a Programmatic SEO project of some sort (probably data presentation from some dataset / AI generation or a combination of both)
  • Simple CMS (essentially just admin for the projects, I'm not going to create a generic CMS)
  • Something else?
Anyway, just a few random thoughts I wanted to express.

Thankful for the forum and I'm hoping to participate, going forward.


  Bootstrap 5.3.7 Released.
Posted by: InsiteFX - 06-20-2025, 04:20 AM - No Replies


Tongue Bug paginate pager in model
Posted by: rdeeceria - 06-18-2025, 10:33 AM - No Replies

Hai, i got a case, the issue is im just try to build pagination using paginate and pager in model. So i create manualy using service('pager') like the user guide, and i check this pager like $detail = $pager->getDetails(). but there is a bug in  $detail['uri']->getQuery().

My query string in browser 'limit=10&page=3&search=bar'
The pager getQuery didnt work well, the number page is not correct and sometimes the page is gone leaving the limit and search, every i reload the browser its a random.

Okay before that sorry for my bad english, and im newbie


  Website Rendering Issue
Posted by: dxbbuggydubai - 06-17-2025, 01:59 PM - Replies (3)

Anybody know about website Rendering issues? I have website showing good live but when i check my website Live Test HTML code from GSC it show many section up and down, nothing align, why this happening, any developer know why?


  Bugs in Tutorial CI4
Posted by: michel42 - 06-17-2025, 04:24 AM - Replies (6)

Hi CodeIgniter Team,
just started learning Codeigniter and doing step by step your Tutorial.
In:
https://codeigniter.com/user_guide/tutor...how-method
In Controller also in Method you use show instead of view and that doesn't work, it should be named to view
Should be changed in Routing "Routes.php", in Controller "News.php"
it was mixed with view and show


  How to display uploaded file from writable/uploads
Posted by: paulgough - 06-17-2025, 01:44 AM - Replies (1)

Hello,
I have a question. In CodeIgniter 4, how can I display the path of an uploaded file from the writable/uploads folder?

I upload various file types including images, documents, PDFs, and CSVs using the following code and store the file paths in the database.

Code:
$file->move(WRITEPATH . 'uploads', $fileName);


All uploaded records are listed on a page, and I need to open the uploaded CSV or Excel files in a new tab from this listing page.

However, I’m unable to retrieve the path from the writable/uploads folder to open it in a new tab.

Code:
<?=WRITEPATH.'uploads/'.$allList->documentCsv?>


When I copy the link and try to open it in a new tab, it downloads instead of displaying the file.

Could you please explain how to properly show the file path?


Wink trim(): Argument #1 ($string)
Posted by: exoed - 06-16-2025, 07:47 PM - No Replies

everytime i create a new project in CI4 4.6.1 with php 8.2.12 i often get this error, what is wrong?

this error comes out when i first run my application.


trim(): Argument #1 ($string) must be of type string, array given 
error at :  SYSTEMPATH\Filters\Filters.php at line 918

911      * @param array  $paths The except path patterns
912      */
913    private function checkPseudoRegex(string $uri, array $paths): bool
914    {
915        // treat each path as pseudo-regex
916        foreach ($paths as $path) {
917            // need to escape path separators
918            $path = str_replace('/', '\/', trim($path, '/ '));
919            // need to make pseudo wildcard real
920            $path = strtolower(str_replace('*', '.*', $path));
921
922            // Does this rule apply here?
923            if (preg_match('#\A' . $path . '\z#u', $uri, $match) === 1) {
924                return true;
925            }

log :
CRITICAL - 2025-06-17 01:45:17 --> TypeError: trim(): Argument #1 ($string) must be of type string, array given
[Method: GET, Route: /]
in SYSTEMPATH\Filters\Filters.php on line 918.
 1 SYSTEMPATH\Filters\Filters.php(918): trim([...], '/ ')
 2 SYSTEMPATH\Filters\Filters.php(881): CodeIgniter\Filters\Filters->checkPseudoRegex('', [...])
 3 SYSTEMPATH\Filters\Filters.php(791): CodeIgniter\Filters\Filters->pathApplies('', [...])
 4 SYSTEMPATH\Filters\Filters.php(474): CodeIgniter\Filters\Filters->processFilters('')
 5 SYSTEMPATH\Filters\Filters.php(218): CodeIgniter\Filters\Filters->initialize('')
 6 SYSTEMPATH\CodeIgniter.php(479): CodeIgniter\Filters\Filters->run('', 'before')
 7 SYSTEMPATH\CodeIgniter.php(354): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
 8 SYSTEMPATH\Boot.php(334): CodeIgniter\CodeIgniter->run()
 9 SYSTEMPATH\Boot.php(67): CodeIgniter\Boot::runCodeIgniter(Object(CodeIgniter\CodeIgniter))
10 FCPATH\index.php(59): CodeIgniter\Boot::bootWeb(Object(Config\Paths))
11 SYSTEMPATH\rewrite.php(44): require_once('C:\\xampp\\htdocs\\geminimenu\\public\\index.php')


 how can i solve this?


  transStatus error
Posted by: okatse - 06-16-2025, 11:27 AM - Replies (4)

Hi
What am I doing wrong?

PHP Code:
        $edb = \Config\Database::connect();
        $res $edb->prepare(function ($edb) {
            $query "select * from test limit :limit";
            return $edb->query($query);
        });
        $edb->transStart();
        $results $res
            
->execute(['limit' => 1])
            ->getResultArray();
        $edb->transComplete(); 
Cannot access protected property CodeIgniter\Database\Postgre\Connection::$transStatus
\Database\BasePreparedQuery.php at line 141


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Latest Threads
AbuseIPDB Module
by grimpirate
23 minutes ago
curl + response body
by okatse
26 minutes ago
Heads up for users using ...
by davis.lasis
11 hours ago
Tool bar not showing
by grimpirate
Yesterday, 10:37 AM
The Hidden Cost of “Innov...
by fcoder
Yesterday, 03:11 AM
tool bar not showing
by InsiteFX
07-01-2025, 09:09 PM
Validation does not appea...
by grimpirate
07-01-2025, 01:55 PM
Block IP addresses of bad...
by grimpirate
07-01-2025, 01:47 PM
Override Router
by grimpirate
07-01-2025, 01:30 PM
CodeIgniter.com - Report ...
by Vikas Mehta
06-30-2025, 10:30 AM

Forum Statistics
» Members: 154,433
» Latest member: marynelson016
» Forum threads: 78,437
» Forum posts: 379,714

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB