close

Welcome Guest, Not a member yet? Register   Sign In
  Over 400k files in the sessions folder
Posted by: geirarnesen - Yesterday, 01:59 AM - Replies (1)
BERJAYA

I discovered that I had over 400k ci_session files in the writeable/session folder.
The oldest files were back from February. I checked the Session.php which had
public int $expiration = 7200;

What is causing those old session files not to be deleted ?

Geir


  BUG: Inconsistent exception handling in testing environment
Posted by: giladsSG - 04-17-2026, 03:44 PM - Replies (2)
BERJAYA

Today, I have run into an issue with exception handling when testing. I was building an API and wanted to take advantage of the exception handler and use exceptions to drive responses and this worked perfectly in dev or production modes. but when I wrote tests for the api endpoints, these exceptions were not being handled by the handler I registered. On digging deeper, I found out that the error handler registered by ci4 was running instead of the exception handler. To be honest, I would not consider myself an exceptional developer, so I have no telling why the error handler was firing instead of the exception handler. Is this a BUG?(current version 4.7.2)
Here is the exception handler: 

PHP Code:
$this->request $request;
        $this->response $response;

        $accessDeniedMessage "You do not have permission to perform this action.";
        $message $exception->getMessage();
        $isVerbose in_array(ENVIRONMENT, ['development''testing']);

        if ($exception instanceof MfaRequiredException) {
            $response api_success($message$exception->getData(), 200);
        } elseif ($exception instanceof ValidationException) {
            $response api_error($message422, ['errors' => $exception->getErrors()]);
        } elseif ($exception instanceof AppException) {
            $response api_error($message$exception->getCode() ?: 400$exception->getData());
        } elseif ($exception instanceof AccessDeniedException) {
            $response api_error($accessDeniedMessage403);
        } else {
            $trackingId api_log_exception($exception);
            $data = [
                'tracking_id' => $trackingId
            
];
            if ($isVerbose) {
                $data['trace'] = $exception->getTrace();
            }

            $response api_error(
                $isVerbose $message 'An error occured. Please try again later.',
                500,
                $data
            
);
        }

        $response->send();

        exit($exitCode); 


  After calling software engineering 'dead,' Anthropic’s Claude Code creator Boris Cher
Posted by: InsiteFX - 04-17-2026, 01:13 PM - No Replies
BERJAYA

After calling software engineering 'dead,' Anthropic’s Claude Code creator Boris Cherny says coding tools like Microsoft VS Code, Apple Xcode, and others will be ‘dead soon’


  *.env file in different location
Posted by: petewulf1 - 04-14-2026, 09:39 AM - Replies (3)
BERJAYA

Hello guys,
It seems there is no official way to place the *.env file at a different location than the projects root folder. Why?
What would be an appropriate way to load from a different location without having to overwrite Boot.php?
Thanks!
Daniel


  feat(DI): Some dependency injection in CI
Posted by: patel-vansh - 04-14-2026, 04:45 AM - Replies (6)
BERJAYA

Hi everyone,
After working with CodeIgniter 4, I wanted to share some thoughts on Dependency Injection and CodeIgniter 4:
This is not a proposal to replace CI4’s simplicity or turn it into another framework. The goal would be to modernize dependency management in a way that still respects CI4’s philosophy: simple, predictable, explicit, and lightweight.

Why Discuss This?
The current Services pattern works well and is easy to understand, but it also has some limitations for larger or more modular applications:
- Uses a service locator pattern rather than constructor injection
- Manual dependency wiring increases as projects grow
For many apps this is not a problem. But for larger projects, cleaner dependency management can be valuable.

Suggested Direction
Introduce a small optional container that can coexist with the current system.
Example:
In the bootstrap process, you can inject any class:

PHP Code:
container()->bindUserRepositoryInterface::class, DatabaseUserRepository::class ); 
And just use it via constructor injection:
PHP Code:
class UserService {
    public function __construct( private readonly UserRepositoryInterface $repo ) {}

    public function getUser(int $userId) {
        return $this->repo->getUser($userId);
    }

Then, in controller:
PHP Code:
$service container()->get(UserService::class); 
This would automatically resolve dependencies recursively.

Example Binding Types
Class to class:
PHP Code:
container()->bind
    CacheInterface::class,
    FileCache::class
); 
Factory closure:
PHP Code:
container()->bind(UserService::class, function ($c) {
    return new UserService(
        $c->get(UserRepository::class),
        'foo'
    );
}); 
Useful when primitives/config values are needed.

Why This Could Benefit CI4
Better testability
Cleaner architecture for medium/large apps
Better package/module ecosystem
Modern PHP patterns while preserving CI4 simplicity
Gradual adoption with zero breakage

After some time, maybe, we can make the current service calls go through this container system, like this:
PHP Code:
function cache(bool $getShared true) {
    if ($getShared) {
        return container()->singleton(CacheInterface::class);
    }

    return container->get(CacheInterface::class);


  Boosting CI4 popularity
Posted by: enlivenapp - 04-13-2026, 08:50 AM - Replies (20)
BERJAYA

I've been a rabid supporter of CI since 1.7.2.  During the 'great lull' Codeigniter really took a hard hit with Laravel coming up and many devs jumping ship. I really want to do my part to help CI get back to the popularity it once had and (*gasp*) maybe rival Laravel.   

While I've been working on my CMS, I've found, what I feel, would be one of the best ways to implement such functionality similar to what Laraval offers. Their Service Providers solution to adding whatever package you want to use would be a massive advantage to Codeigniter.

The one argument I often hear/read is 'composer whatever' has this, just 'composer require' it and use it (usually coming across as kinda negative nancy since text has no real context).  I get that and it's 100% true, but that advice doesn't really cut it when CI is better than many frameworks in many ways but kinda can't get out of it's own way.  
  
As always, lively discussion is wanted, I'd really like to hear from the Foundation devs too.  Is there any interest from the Foundation to create a Service Provider/Packages and much expanded spark CLI kind of ecosystem for Codeigniter? 

Happy coding.


Heart Ragnos: A "Configuration over Code" Enterprise Add-on built on CI4
Posted by: cgarciagl - 04-09-2026, 05:19 PM - Replies (5)
BERJAYA

Hello everyone,
I have been using and loving CodeIgniter for years. I work as a developer and academic technician at a University Research Center, where we constantly build administrative and educational systems. While CI4 is blazing fast and elegantly structured, I found myself getting burned out writing the exact same CRUD controllers, HTML views, data tables, and permission logic for every new project.

To keep my sanity, I built a higher-level enterprise add-on entirely on top of CodeIgniter 4 called Ragnos. I just released it as 100% open-source and wanted to share it with the community that makes CI4 possible.

The core philosophy of Ragnos is "Configuration over Programming." Instead of writing standard MVC boilerplate for admin panels, you use our RDatasetController. You simply define a "Data Dictionary" (a plain PHP array) in your controller, and this add-on automatically renders a fully styled dashboard, handles pagination, advanced search filters, data exports, and forms.

Because it runs native CI4 under the hood, it automatically benefits from its Query Builder, CSRF protection, and XSS filtering, but it adds a dynamic Role-Based Access Control (RBAC) layer on top. Also, since modules are generated from PHP arrays, it is incredibly easy to use AI to write your configurations and generate entire modules in seconds.

You can check out the documentation, the philosophy, and the GitHub repository here: https://ragnos.build

Because the project grew quite a bit, I also wrote a complete 162-page official manual called "Ragnos from Zero to Pro" (available in English and Spanish on Leanpub) for those who want to master the architecture or implement it at an enterprise level. But the core add-on is completely free and open for the community.

I would love for the CI experts here to take a look at the code, install it, break it, and give me your honest feedback. I owe a lot to CodeIgniter, and I hope this contribution helps other developers save as much time as it has saved me.
Thanks for reading and happy coding!


  Claude Code Skills
Posted by: enlivenapp - 04-08-2026, 12:01 AM - Replies (6)
BERJAYA

I had mentioned this buried in one of my other posts.  I've had to keep claude code on a short leash because it seems to do whatever it wants. So, I had some skills for claude to use. Tonight I updated them, broke out Shield from the ci4 skill and went pretty detailed for the skills.  All free to use as cheat sheets or load up in claude (maybe other LLMs) and get something resembling what CI4 is supposed to be used for.  I'm working on a CI4 plugin too, but that's extra tokens when I have them. 

fork it, PR it, whatever you need.
https://github.com/enlivenapp/Codeignite...laude-Code

Happy Coding!


  Testing same tables
Posted by: ozornick - 04-04-2026, 03:14 AM - Replies (6)
BERJAYA

I have several modules: Main, Blog, Shop...
Each contains tests modules/src/Shop/Tests/* and data Shop/Database/{Migrations|Seeders} for them.
Errors occurred with identical tables (posts, users..) in the same test database. I am using the SQLite3 file.

How best to split the execution (random tests) without creating many connections: tests, tests_for_main, test_for_shop..? Because sometimes you may need data from modules that do not overlap.

In general, working with migrations is very strict - you can't just execute import and seeder files. And auto-searching of this data may be unsuitable: for example, when the imported data is located outside of ./Database/* or has a non-standard FQCN.

My test begin as:

PHP Code:
final class PostModelTest extends CIUnitTestCase
{
    use 
DatabaseTestTrait;

    protected 
$namespace = [
        
'Neznaika0\Module\Blog',
        
'Neznaika0\Module\Shop',
    ];
    protected 
$seed = [
        
UserSeeder::class,
        
PostSeeder::class,
    ];
    protected 
$migrateOnce false;
    protected 
$seedOnce    false


  Best way to implement a Service Layer in CI4 for complex business logic?
Posted by: marinkitagawa - 04-03-2026, 12:42 PM - Replies (2)
BERJAYA

I’m working on a large-scale project in CodeIgniter 4 and I want to keep my controllers as lean as possible. Currently, I’m using centralized validation in

Code:
Config/Validation.php
, but I’m struggling with where to put complex business logic that doesn't belong in the Model or the Controller.
My questions are:
  1. Is creating a separate
    Code:
    app/Services
    directory the standard approach in CI4 for handling business logic?
  2. How should I properly initialize these services? Should I use the
    Code:
    Services
    configuration file or just instantiate them normally in the controller?
  3. Are there any performance overheads or architectural 'gotchas' I should be aware of when moving logic out of the controller?
I'd love to hear how you guys structure your enterprise-level applications. Thanks!


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

Username
  

Password
  





Latest Threads
BUG: Inconsistent excepti...
by ozornick
8 hours ago
Over 400k files in the se...
by ozornick
Yesterday, 09:14 AM
After calling software en...
by InsiteFX
04-17-2026, 01:13 PM
feat(DI): Some dependency...
by TwistedAndy
04-16-2026, 09:47 AM
Laravel vs CodeIgniter: W...
by FlavioSuar
04-16-2026, 08:25 AM
*.env file in different l...
by ozornick
04-15-2026, 01:00 AM
Boosting CI4 popularity
by michalsn
04-14-2026, 09:09 AM
Ragnos: A "Configuration ...
by ozornick
04-11-2026, 11:36 PM
Claude Code Skills
by enlivenapp
04-10-2026, 12:57 PM
Slowing down the Internet
by ozornick
04-07-2026, 10:55 AM

Forum Statistics
» Members: 208,620
» Latest member: sunwin108innet
» Forum threads: 78,679
» Forum posts: 380,891

Full Statistics

Search Forums

(Advanced Search)


Theme © iAndrew 2016 - Forum software by © MyBB