Welcome Guest, Not a member yet? Register   Sign In
How do i install older version of CI4 using composer
#11

I've created a small command.
https://github.com/kenjis/ci4-composer-installer
Reply
#12

Hi @kenjis ,

Thank you do much for the help. It helped a lot. Only thing i could not upgrade it later.
Reply
#13

That applet intentionally locks composer.json to the requested version. If you want to update it later you will need to modify composer.json and change the requirement back to an open-ended dependency (like `^4.1`)
Reply
#14

(This post was last modified: 07-14-2022, 05:20 AM by murugappan.)

(07-14-2022, 04:17 AM)MGatner Wrote: That applet intentionally locks composer.json to the requested version. If you want to update it later you will need to modify composer.json and change the requirement back to an open-ended dependency (like `^4.1`)

Hi, Thank you for the feedback and help. This is what i did:

(1) Create a new CI4 "ci4tst" using "php ci4-install.php ci4tst 4.1.9" - successful but failed on this lines:

Code:
cd ci4tst; composer require -W codeigniter4/framework:4.1.9
The system cannot find the path specified.

(2) ran the commands manually - successful
(3) ran the php spark to test - successful, shows version 4.1.9
(4) Edited composer.json as:
Code:
"require": {
        "php": "^7.3 || ^8.0",
        "codeigniter4/framework": "^4.1"
    },
(5) Delete vendor folder and ran composer install - successful
(6) Ran "composer update". Generates the following messages:
Code:
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading codeigniter4/framework (v4.1.9 => v4.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Upgrading codeigniter4/framework (v4.1.9 => v4.2.1): Extracting archive
Generating autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

(7) Ran php spark - failed with the messages:
Code:
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to CodeIgniter\CLI\Console::__construct() must be an instance of CodeIgniter\CodeIgniter, int given, called in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark on line 48 and defined in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php:29
Stack trace:
#0 C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark(48): CodeIgniter\CLI\Console->__construct(1)
#1 {main}
  thrown in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php on
line 29

Fatal error: Uncaught TypeError: Argument 1 passed to CodeIgniter\CLI\Console::__construct() must be an instance of CodeIgniter\CodeIgniter, int given, called in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark on line 48 and defined in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php:29
Stack trace:
#0 C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark(48): CodeIgniter\CLI\Console->__construct(1)
#1 {main}
  thrown in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php on
line 29
Any advise. We could always install the latest version and add the codes from the older version. But there are times when I find using the latest version, the apps produces different results or breaks and I need confirm that it is not due to the latest version. I hope you understand my needs.

(07-14-2022, 05:17 AM)murugappan Wrote:
(07-14-2022, 04:17 AM)MGatner Wrote: That applet intentionally locks composer.json to the requested version. If you want to update it later you will need to modify composer.json and change the requirement back to an open-ended dependency (like `^4.1`)

Hi, Thank you for the feedback and help. This is what i did:

(1) Create a new CI4 "ci4tst" using "php ci4-install.php ci4tst 4.1.9" - successful but failed on this lines:

Code:
cd ci4tst; composer require -W codeigniter4/framework:4.1.9
The system cannot find the path specified.

(2) ran the commands manually - successful
(3) ran the php spark to test - successful, shows version 4.1.9
(4) Edited composer.json as:
Code:
"require": {
        "php": "^7.3 || ^8.0",
        "codeigniter4/framework": "^4.1"
    },
(5) Delete vendor folder and ran composer install - successful
(6) Ran "composer update". Generates the following messages:
Code:
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Upgrading codeigniter4/framework (v4.1.9 => v4.2.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Upgrading codeigniter4/framework (v4.1.9 => v4.2.1): Extracting archive
Generating autoload files
27 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

(7) Ran php spark - failed with the messages:
Code:
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to CodeIgniter\CLI\Console::__construct() must be an instance of CodeIgniter\CodeIgniter, int given, called in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark on line 48 and defined in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php:29
Stack trace:
#0 C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark(48): CodeIgniter\CLI\Console->__construct(1)
#1 {main}
  thrown in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php on
line 29

Fatal error: Uncaught TypeError: Argument 1 passed to CodeIgniter\CLI\Console::__construct() must be an instance of CodeIgniter\CodeIgniter, int given, called in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark on line 48 and defined in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php:29
Stack trace:
#0 C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\spark(48): CodeIgniter\CLI\Console->__construct(1)
#1 {main}
  thrown in C:\xampp\htdocs\MyDevelop\ci4vanilla\ci4tst\vendor\codeigniter4\framework\system\CLI\Console.php on
line 29

Any advise. We could always install the latest version and add the codes from the older version. But there are times when I find using the latest version, the apps produces different results or breaks and I need confirm that it is not due to the latest version. I hope you understand my needs.

Previously we had, i think under CI3, we could run composer to install older version and they worked fine.
Reply
#15

(07-14-2022, 05:17 AM)murugappan Wrote: (1) Create a new CI4 "ci4tst" using "php ci4-install.php ci4tst 4.1.9" - successful but failed on this lines:

Code:
cd ci4tst; composer require -W codeigniter4/framework:4.1.9
The system cannot find the path specified.

I updated ci4-install.php.
Can you check the error fixed?
Reply
#16

(07-14-2022, 02:30 PM)kenjis Wrote:
(07-14-2022, 05:17 AM)murugappan Wrote: (1) Create a new CI4 "ci4tst" using "php ci4-install.php ci4tst 4.1.9" - successful but failed on this lines:

Code:
cd ci4tst; composer require -W codeigniter4/framework:4.1.9
The system cannot find the path specified.

I updated ci4-install.php.
Can you check the error fixed?

Hi @kenjis,

The update works great. I tried composer update. It appears to go through but when i run php spark it fails. I guess once I create the app this way we cannot perform a composer update to the latest version.
Reply
#17

@murugappan

The error "Uncaught TypeError: Argument 1 passed to CodeIgniter\CLI\Console::__construct() must be an instance of CodeIgniter\CodeIgniter, int given" is expected. Because of the breaking changes in index.php or spark.

I added the explanation.
See https://github.com/kenjis/ci4-composer-i...deigniter4
Reply
#18

(This post was last modified: 07-14-2022, 03:50 PM by murugappan.)

(07-14-2022, 03:06 PM)kenjis Wrote: @murugappan

The error "Uncaught TypeError: Argument 1 passed to CodeIgniter\CLI\Console::__construct() must be an instance of CodeIgniter\CodeIgniter, int given" is expected. Because of the breaking changes in index.php or spark.

I added the explanation.
See https://github.com/kenjis/ci4-composer-i...deigniter4

I tried the patch after installing tatter/patches. Unfortunately, this uses unix commands but I am on Windows. So i performed a Composer Update and then updated the index.php and spark as stated in the manual method for upgrade.

Works fantastic. Thank you so much.
Reply
#19

I added how to upgrade by another update tool Liaison Revision.
See https://github.com/kenjis/ci4-composer-i...n-revision

Note: Patches and Liaison Revision are completely different tools. They work differently.
Reply
#20

(07-14-2022, 04:26 PM)kenjis Wrote: I added how to upgrade by another update tool Liaison Revision.
See https://github.com/kenjis/ci4-composer-i...n-revision

Note: Patches and Liaison Revision are completely different tools. They work differently.

I understand that. Thank you so much.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB