CodeIgniter Forums
CodeIgniter 3 to 4 Upgrade Helper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Addins (https://forum.codeigniter.com/forumdisplay.php?fid=34)
+--- Thread: CodeIgniter 3 to 4 Upgrade Helper (/showthread.php?tid=78565)



CodeIgniter 3 to 4 Upgrade Helper - kenjis - 02-08-2021

Hi, everyone.

I started to develop a tool which reduces upgrade costs from CodeIgniter3 to CodeIgniter4.

https://github.com/kenjis/ci3-to-4-upgrade-helper

This project is under early development.

It provides compatible interfaces for common use cases in CodeIgniter3 apps.
You can run the following code on CodeIgniter4.
PHP Code:
<?php
namespace App\Models;

use 
Kenjis\CI3Compatible\Core\CI_Model;

class 
News_model extends CI_Model
{
    public function __construct()
    {
        parent::__construct();

        $this->load->database();
    }

    public function get_news($slug false)
    {
        if ($slug === false) {
            $query $this->db->get('news');
            return $query->result_array();
        }

        $query $this->db->get_where('news', ['slug' => $slug]);
        return $query->row_array();
    }

    public function set_news()
    {
        $this->load->helper('url');

        $slug url_title($this->input->post('title'), '-'true);

        $data = [
            'title' => $this->input->post('title'),
            'slug'  => $slug,
            'text'  => $this->input->post('text')
        ];

        return $this->db->insert('news'$data);
    }




RE: CodeIgniter 3 to 4 Upgrade Helper - kenjis - 02-10-2021

I upgraded codeigniter3-qrcode to CI4 with ci3-to-4-upgrade-helper.
https://github.com/kenjis/ci4-qrcode

[Image: attachment.php?aid=1986]
[Image: attachment.php?aid=1987]


RE: CodeIgniter 3 to 4 Upgrade Helper - kenjis - 02-19-2021

If you want to see upgraded Test Code,
see https://github.com/kenjis/ci3-to-4-news/tree/main/tests/app


RE: CodeIgniter 3 to 4 Upgrade Helper - Kiranrs - 02-20-2021

Wow, surprised. It'll help for many users, no doubt. Smile


RE: CodeIgniter 3 to 4 Upgrade Helper - kenjis - 02-21-2021

(02-20-2021, 10:18 AM)Kiranrs Wrote: Wow, surprised. It'll help for many users, no doubt. Smile
Thanks! I hope that will happen.


RE: CodeIgniter 3 to 4 Upgrade Helper - kenjis - 03-18-2021

I've released v0.1.0.
https://github.com/kenjis/ci3-to-4-upgrade-helper/releases

The official news tutorial works perfectly.
https://github.com/kenjis/ci3-to-4-news


RE: CodeIgniter 3 to 4 Upgrade Helper - mehmetc - 09-27-2021

(03-18-2021, 11:06 PM)kenjis Wrote: I've released v0.1.0.
https://github.com/kenjis/ci3-to-4-upgrade-helper/releases

The official news tutorial works perfectly.
https://github.com/kenjis/ci3-to-4-news
I get an error that says:

"""
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires kenjis/ci3-to-4-upgrade-helper 1.x-dev -> satisfiable by kenjis/ci3-to-4-upgrade-helper[1.x-dev].
    - kenjis/ci3-to-4-upgrade-helper 1.x-dev requires php ^7.3 -> your php version (8.0.10) does not satisfy that requirement.
"""

I think it may be resolved by adding this to composer.json file in ci3-to-4-upgrade-helper repository:

"php": "^7.3|^8.0",

Can you please check this error out and let me know?


RE: CodeIgniter 3 to 4 Upgrade Helper - kenjis - 09-29-2021

(09-27-2021, 11:06 AM)mehmetc Wrote: I get an error that says:

"""
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires kenjis/ci3-to-4-upgrade-helper 1.x-dev -> satisfiable by kenjis/ci3-to-4-upgrade-helper[1.x-dev].
    - kenjis/ci3-to-4-upgrade-helper 1.x-dev requires php ^7.3 -> your php version (8.0.10) does not satisfy that requirement.
"""

I think it may be resolved by adding this to composer.json file in ci3-to-4-upgrade-helper repository:

"php": "^7.3|^8.0",

Can you please check this error out and let me know?

Thank you for reporting.

I added ^8.0 in 1.x branch.

Now you can install kenjis/ci3-to-4-upgrade-helper:1.x-dev on PHP 8.0.

Some functions were broken with progress of CI4 development.
I fixed them and made all tests pass.

I will check more with CI4 apps, and would release the next version.

If you get something wrong, let me know.


RE: CodeIgniter 3 to 4 Upgrade Helper - kenjis - 01-14-2022

v0.2.0 released.
https://github.com/kenjis/ci3-to-4-upgrade-helper/releases

now support CodeIgniter 4.1.3 or later.
It is not fully tested, but phpunit tests passed on PHP 8.1.

Upgrade Tool using ci3-to-4-upgrade-helper was created and shared!
https://forum.codeigniter.com/thread-80995.html


RE: CodeIgniter 3 to 4 Upgrade Helper - kenjis - 01-14-2022

v0.3.0 was released!
https://github.com/kenjis/ci3-to-4-upgrade-helper/releases

Now supports Language files.
See https://github.com/kenjis/ci3-to-4-upgrade-helper/blob/1.x/docs/HowToUpgradeFromCI3ToCI4.md#language-files