↧
You'll fly through the terminal once you master these 5 Bash shortcuts
↧
CI User Badges
Hello CI community.
I would love to be able to contribute to the CI core development but I'm not as good as I need to be, so in my MCGA (make the community great again) quest, I decided to create some CI resources to show 1) even more stuff is actively going on with CI and 2) help promote the use of CI as much as I can.
The first part of this effort is the CI user badges which I think are a cool fun way to show your CI pride. Visit https://ci-badges.supertechman.com/ get your badge, display it on your socials and tell everyone (I just started, so there are a lot of low numbers to claim - I'm number 1, LOL).
Feel free to connect on GH or X to help me make this better. Other things to come.
I will post this exact message in all other places I know CI users congregate.
Cheers,
Rui
↧
↧
What is Cloudflare? The invisible service behind today’s mass internet issues
↧
Load Custom Helper Only in Specific Controllers?
Hi everyone,
I’m working on a CodeIgniter 4 project and I have a custom helper that I want to use, but only in a few specific controllers. I know I can load helpers globally in
, but I don’t want it to be loaded for every controller because it’s not needed everywhere.
What’s the best way to load a helper automatically only for certain controllers without manually calling
in every method? Is there a clean approach for this in CodeIgniter 4?
Thanks in advance for any guidance!
I’m working on a CodeIgniter 4 project and I have a custom helper that I want to use, but only in a few specific controllers. I know I can load helpers globally in
Code:
Config/Autoload.phpWhat’s the best way to load a helper automatically only for certain controllers without manually calling
Code:
helper('my_helper')Thanks in advance for any guidance!
↧
Introducing Igniter CMS: A Lightweight CMS Built on CodeIgniter 4
Hello everyone,
I wanted to share a project I've been working on called IgniterCMS. It's a free, open-source CMS built on CodeIgniter 4 that I originally started for personal use and client projects. Over the past year, it has evolved significantly and is now a more comprehensive solution.
It features content management, theme and plugin support, user management, and both MVC and headless API options for frontend development. There's also integrated AI assistance, SEO tools, and analytics.
If you're interested, you can check it out here:
GitHub: https://github.com/akassama/igniter-cms
Website: https://ignitercms.com/
Demo: https://demo.ignitercms.com/
Documentation: https://docs.ignitercms.com/
I would appreciate any feedback or contributions. Thanks!
I wanted to share a project I've been working on called IgniterCMS. It's a free, open-source CMS built on CodeIgniter 4 that I originally started for personal use and client projects. Over the past year, it has evolved significantly and is now a more comprehensive solution.
It features content management, theme and plugin support, user management, and both MVC and headless API options for frontend development. There's also integrated AI assistance, SEO tools, and analytics.
If you're interested, you can check it out here:
GitHub: https://github.com/akassama/igniter-cms
Website: https://ignitercms.com/
Demo: https://demo.ignitercms.com/
Documentation: https://docs.ignitercms.com/
I would appreciate any feedback or contributions. Thanks!
↧
↧
PHP’s Next Chapter: From Web Framework to Agent Framework
Interesting read. Dev.to link ( https://dev.to/inspector/phps-next-chapt...ework-59p4 )
↧
I'm having some trouble integrating Bootstrap into my CodeIgniter application
I'm currently working on a project and I'm having some trouble integrating Bootstrap into my CodeIgniter application. I've tried a few methods, but none seem to be working as expected. Could someone please provide a clear step-by-step guide or tips on how to successfully integrate Bootstrap with CodeIgniter?
Your assistance would be greatly appreciated. Thank you!
Your assistance would be greatly appreciated. Thank you!
↧
PHP 8.5.0 Relesed
PHP 8.5.0 Released.
↧
Key Features in PHP 8.5
↧
↧
Tracking moved filename changes
In my CI4 document management system, uploaded files are stored in sub-folders within /public/uploads/. The sub-folders are set according to the category assigned to the files as they are added (finance, insurance, property etc). The categories are held in a separate table, and the category table field names populate the document form select field.
I've only now realised that if I add a document to a sub-folder where the same document name exists, CI appends a '_1' etc to the filename, so the second file named image.jpg becomes image_1.jpg etc, but the new filename wasn't being logged in the db, which still held image.jpg in the filename field. I dealt with that by grabbing the new filename and updating the table $data array before updating the db with:
But, I can't work out how to do this when I subsequently move the file from one category sub-folder to another by changing the Category field within the Edit form, where there is already a filename and CI4 has to append _1 etc. By that I mean I can change the category within the document form so that the uploaded file physically moves from the old sub-folder to the new one, but I can't find a way to grab the moved file name to update the db. I get: 'Call to a member function getName() on string' as an error message.
Edit: the CI4 file move method seems to need the full path, which is perhaps why I can't extract just the filename.
$documentModel->update($id, $data);
$session->setFlashdata('msg1', 'Record edited');
return redirect()->route('session-build');
} else {
$session->setFlashdata('msg1', 'Invalid edit');
return redirect()->route('documents-list');
etc...
Thanks
I've only now realised that if I add a document to a sub-folder where the same document name exists, CI appends a '_1' etc to the filename, so the second file named image.jpg becomes image_1.jpg etc, but the new filename wasn't being logged in the db, which still held image.jpg in the filename field. I dealt with that by grabbing the new filename and updating the table $data array before updating the db with:
Code:
$theFile->move('./uploads/' . strtolower($catName));
$data['filename'] = $theFile->getName();
$documentModel->insert($data);Edit: the CI4 file move method seems to need the full path, which is perhaps why I can't extract just the filename.
Code:
// check whether category has changed
$record = $documentModel->find($id);
$existingCat = $record['category'];
$updatedCat = $this->request->getVar('category');
$filetomove = $record['filename'];
if($existingCat != $updatedCat)
{
// $filetomove = $record['filename'];
$newCat = $db->query("SELECT name FROM dms_category where id = $updatedCat");
$newRow = $newCat->getRow();
$newCatName = $newRow->name;
$newPath = './uploads/' . strtolower($newCatName);
// $newPath = ROOTPATH . 'writable/uploads/' . strtolower($newCatName);
$fullNewPath = $newPath . '/' . $filetomove;
$oldCat = $db->query("SELECT name FROM dms_category where id = $existingCat");
$oldRow = $oldCat->getRow();
$oldCatName = $oldRow->name;
$oldPath = './uploads/' . strtolower($oldCatName);
// $oldPath = ROOTPATH . 'writable/uploads/' . strtolower($oldCatName);
$fullOldPath = $oldPath . '/' . $filetomove;
if(file_exists($fullOldPath))
{
$file = new \CodeIgniter\Files\File($fullOldPath);
$file->move($newPath);
$data['filename'] = $filetomove->getName();
$session->setFlashdata('msg2', 'Document moved');
}
}
// In case there is already a file with that name in the destination category folder$session->setFlashdata('msg1', 'Record edited');
return redirect()->route('session-build');
} else {
$session->setFlashdata('msg1', 'Invalid edit');
return redirect()->route('documents-list');
etc...
Thanks
↧
The Neuron - Stay ahead of the AI revolution.
↧
docs: Improve guides
A section with guides will soon appear in the documentation. At the beginning, it contains a tutorial for the first application and API development.
https://github.com/codeigniter4/CodeIgniter4/pull/9808
Does anyone have the opportunity to add to the experience of using the framework? I think that would be great.
I have already offered to share my case, but I was refused because of the "imposed development style".
https://github.com/codeigniter4/CodeIgniter4/pull/9262
Therefore, the guide should preferably describe the general (built-in) functionality.
https://github.com/codeigniter4/CodeIgniter4/pull/9808
Does anyone have the opportunity to add to the experience of using the framework? I think that would be great.
I have already offered to share my case, but I was refused because of the "imposed development style".
https://github.com/codeigniter4/CodeIgniter4/pull/9262
Therefore, the guide should preferably describe the general (built-in) functionality.
↧
feat: add a standard way to detect email views in view decorators
There is no way to detect when a view is rendered for an email in CodeIgniter4. This causes scripts and markup from view decorators to be injected into emails as well.
There should be a standard way for third-party libraries to know if the output target is an email so unnecessary HTML can be skipped.
Adding an email detection mechanism would:
This is not viable for third-party libraries because they do not ultimately control what the users include in their views.
This small change would help all projects and libraries handle email output correctly without workarounds.
NB: I'm up for submitting a PR for this
Previously discussed on Slack : https://codeigniterchat.slack.com/archiv...3103469699
There should be a standard way for third-party libraries to know if the output target is an email so unnecessary HTML can be skipped.
Adding an email detection mechanism would:
- Prevent unnecessary content in outgoing emails.
- Allow libraries to skip injecting markup for email views.
- Provide a context variable accessible to decorators. (context could somehow be injected by the email class??)
- Add an isEmail flag to the view renderer options
- something else ??
This is not viable for third-party libraries because they do not ultimately control what the users include in their views.
This small change would help all projects and libraries handle email output correctly without workarounds.
NB: I'm up for submitting a PR for this
Previously discussed on Slack : https://codeigniterchat.slack.com/archiv...3103469699
↧
↧
Multiple session ids
Hi,
I was reviewing my use of session variables and having problems displaying them in a view after instantiating in a base-type controller with $session = service('session', $config);
So I searched github to see how other devs manage their sessions and came across
I used
and also
I now have 3 session ids: session_id() which is the real session id, I echo'd out (I assume masked by the CI session functions)
When I dump $_SESSION I can see it has myarray and myarray2 each with different session ids.
I'm happy to use $session but am wondering where the session() is coming from and why session_id() is displaying 3 different session ids
I was reviewing my use of session variables and having problems displaying them in a view after instantiating in a base-type controller with $session = service('session', $config);
So I searched github to see how other devs manage their sessions and came across
Code:
session()->set('var', 'value);I used
Code:
session()->set('myarray', ['sessionId' => session_id()])Code:
$session->set('myarray2', ['sessionId' => session_id()])I now have 3 session ids: session_id() which is the real session id, I echo'd out (I assume masked by the CI session functions)
When I dump $_SESSION I can see it has myarray and myarray2 each with different session ids.
I'm happy to use $session but am wondering where the session() is coming from and why session_id() is displaying 3 different session ids
↧
Automatic REST API generator for CI4 with API Documentation
Hey everyone!
I’ve published a new Composer package — jivtesh/ci4-api-generator — designed specifically for CodeIgniter 4 to help you create REST APIs instantly and effortlessly. Package creates complete API documentation as well using openAPI.json and Scalar.
This package automatically generate RESTful APIs for your CodeIgniter 4 application based on your MySQL database tables. No code required! Just install, configure your database, and your APIs are ready to use.
Install via composer:
Check complete documentation and repo at https://github.com/jivtesh813/ci4-api-generator
Do let me know if you like it. Some of the features are as below:
![[Image: api_docs.png]]()
![[Image: api_filter.png]]()
Thanks,
Jivtesh
I’ve published a new Composer package — jivtesh/ci4-api-generator — designed specifically for CodeIgniter 4 to help you create REST APIs instantly and effortlessly. Package creates complete API documentation as well using openAPI.json and Scalar.
This package automatically generate RESTful APIs for your CodeIgniter 4 application based on your MySQL database tables. No code required! Just install, configure your database, and your APIs are ready to use.
Install via composer:
Code:
composer require jivtesh/ci4-api-generatorCheck complete documentation and repo at https://github.com/jivtesh813/ci4-api-generator
Do let me know if you like it. Some of the features are as below:
- Instant API Generation: APIs work immediately after installation - no additional setup required
- Full CRUD Operations: Automatic GET, POST, PUT, DELETE endpoints for all tables
- Composite Primary Key Support: Automatically handles tables with single or multiple primary keys
- Smart Validation: Auto-generates validation rules from database schema
- OpenAPI/Swagger Documentation: Beautiful interactive API documentation with Scalar UI
- Pagination Support: Built-in pagination for listing endpoints
- Advanced Filtering: Filter records by any column via query parameters
- Multi-tenant Support: Built-in column filtering for multi-tenant applications
- Flexible Configuration: Customize everything - endpoints, columns, validation rules per table
- Foreign Key Support: Automatically detects relationships
- Route Caching: Fast performance with intelligent route caching
- CLI Commands: Powerful commands to manage and inspect your APIs
![[Image: api_docs.png]](http://i.postimg.cc/hv6v9HhK/api_docs.png)
![[Image: api_filter.png]](http://i.postimg.cc/T24KMW0L/api_filter.png)
Thanks,
Jivtesh
↧
Using modules in CI4
Hello,
My project has two modules: Blog and Shop. I've followed the instructions in the docs to configure the namespaces correctly in app/Config/Autoload.php.
So here's what my project looks like now:
app/Config/Autoload.php:
I've a couple of questions:
1. Is there a way to make the autoloader automatically detect the modules that I add or remove from my src folder instead of having to manually update the $psr4 variable every time?
2. Where do I put the files that are common to all the modules? Right now, I've created a 'Common' module that contains a BaseController.php and layout.php that is extended by the controllers and views in the other modules, like so:
This certainly works, but I was wondering what's the best practice to do this?
Thanks
My project has two modules: Blog and Shop. I've followed the instructions in the docs to configure the namespaces correctly in app/Config/Autoload.php.
So here's what my project looks like now:
Code:
my-site
- app
- public
- src
- Blog
- Config
Routes.php
- Controllers
PostController.php
- Models
- Views
- create.php
- list.php
- Shop
- tests
- vendor
- writableapp/Config/Autoload.php:
PHP Code:
<?php
public $psr4 = [
APP_NAMESPACE => APPPATH,
'Src\Blog' => ROOTPATH . 'src/Blog',
'Src\Shop' => ROOTPATH . 'src/Shop',
];
I've a couple of questions:
1. Is there a way to make the autoloader automatically detect the modules that I add or remove from my src folder instead of having to manually update the $psr4 variable every time?
2. Where do I put the files that are common to all the modules? Right now, I've created a 'Common' module that contains a BaseController.php and layout.php that is extended by the controllers and views in the other modules, like so:
Code:
my-site
- app
- public
- src
- Blog
- Shop
- Common
- Controllers
BaseController.php
- Views
- layout.php
- tests
- vendor
- writableThis certainly works, but I was wondering what's the best practice to do this?
Thanks
↧
Integrate ActivityPub in CodeIgniter
I don't want to reinvent the wheel. I am looking for example of integration of ActivityPub in CI.
Any Tutorial step by step
Any documentation or code ?
I already found https://github.com/landrok/activitypub But how to use it ? The documentation looks like automatic or generated doc.
Any Tutorial step by step
Any documentation or code ?
I already found https://github.com/landrok/activitypub But how to use it ? The documentation looks like automatic or generated doc.
↧
↧
How to convert the query below into Codeigniter
Hello,
How do I convert the query below into Codeigniter?
How do I convert the query below into Codeigniter?
Code:
php
select agency from agency
where agency not in (
SELECT agency FROM trip
where trip_type = 'local trip'
group by trip_type, agency
having count(agency)=(select count(*) from role)
);↧
Help
I have the following project structure:
root/sistema/application
root/sistema/system
root/assets/jquery
root/web1
root/web2
root/web3
I want all the websites (web1, web2, web3) to share the same CodeIgniter installation located in root/sistema, including using it for their basic views. I also need each site to keep its own URL structure. What is the best or recommended way to configure CodeIgniter so that all the sites can use the same framework while maintaining separate URLs?
root/sistema/application
root/sistema/system
root/assets/jquery
root/web1
root/web2
root/web3
I want all the websites (web1, web2, web3) to share the same CodeIgniter installation located in root/sistema, including using it for their basic views. I also need each site to keep its own URL structure. What is the best or recommended way to configure CodeIgniter so that all the sites can use the same framework while maintaining separate URLs?
↧
Should I Remove PHP & Apache Before Installing XAMPP on Ubuntu?
Am going through a CodeIgniter tutorial and was advised by instructor on first developing locally and then deploying to hosting My local environs is Ubuntu 22.04. Initially, I installed PHP and Apache2, but realized the instructor specified XAMPP. If I were to install XAMPP, should I first purge all local php and apache2 installs or will the two play together nicely and I ought to be able to run everything smooth?
↧