Welcome Guest, Not a member yet? Register   Sign In
Shield - Problems on first setup - missing files
#1

(This post was last modified: 11-28-2024, 02:32 PM by 4usol.)

Hi,

after some trouble (caused by my less understandings of some technical thinks) i've installed codeigniter4/appstarter by composer.

After that i installed shield by composer

Here is the log of the last parts

"bash-5.1$ /usr/local/php82/bin/php composer.phar require codeigniter4/shield
./composer.json has been updated
Running composer update codeigniter4/shield
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
  - Locking codeigniter4/settings (v2.2.0)
  - Locking codeigniter4/shield (v1.1.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Downloading codeigniter4/shield (v1.1.0)
  - Installing codeigniter4/settings (v2.2.0): Extracting archive
  - Installing codeigniter4/shield (v1.1.0): Extracting archive
Generating optimized autoload files
26 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^1.1 for codeigniter4/shield
bash-5.1$ /usr/local/php82/bin/php spark shieldConfusedetup

CodeIgniter v4.5.5 Command Line Tool - Server Time: 2024-11-28 20:23:18 UTC+00:00

  Created: APPPATH/Config/Auth.php
  Created: APPPATH/Config/AuthGroups.php
  Created: APPPATH/Config/AuthToken.php
  Updated: APPPATH/Config/Autoload.php
  Updated: APPPATH/Config/Routes.php
  Updated: We have updated file 'APPPATH/Config/Security.php' for security reasons.
  Updated: APPPATH/Config/Email.php

  Run `spark migrate --all` now? [y, n]: y
Running all new migrations...
        Running: (CodeIgniter\Shield) 2020-12-28-223112_CodeIgniter\Shield\Database\Migrations\CreateAuthTables
        Running: (CodeIgniter\Settings) 2021-07-04-041948_CodeIgniter\Settings\Database\Migrations\CreateSettingsTable
        Running: (CodeIgniter\Settings) 2021-11-14-143905_CodeIgniter\Settings\Database\Migrations\AddContextColumn
Migrations complete."


After all, i see in my database some new "auth_"-tables.

If if look into the app/Controller folder - i miss all files about the authentification part for example "ActionController, LoginController, RegisterController..."
Also in App/views is only the error-folder and the welcome-message files. I think there must be much more files for example "login, register etc"

Why this files not in my folders, normaly this files should copy by installtion with the composer or am i wrong?

It seems that all the files from the shield-package are not copied to my folder!?

What i do wrong and what i should do now?
Reply
#2

They are not copied, they stay in the shield/src/Controllers folder.

They have Routes setup for them.

you should be able to just type register to register a new users, login to login.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

I've check my folder, but there is no "shield" folder.

To take care, that i understand the process correctly, normaly if i install via composer, it should create this folder and download all files, or not?

At the moment i cannot do anything - only the welcomepage is avivable..
Reply
#4

(This post was last modified: 11-29-2024, 04:12 AM by captain-sensible. Edit Reason: forgot chmod bit )

looking at composer.phar it looks like you downloaded it manually ; i wonder where it is ? what do you get if you run :
Code:
[andrew@darkstar ~]$ which composer
/usr/bin/composer

I'm wondering about PATH , take this the +ve way , its only cause on another question i answered it was about PATH problems. To get composer to be used by system globally either install using package manager or , lets say composer.phar is on your Desktop:

Code:
[andrew@darkstar Desktop]$
sudo chmod a+x  composer.phar
sudo mv   composer.phar      /usr/bin/composer


a+x will give it chmod permission to run ; the mv renames it from composer.phar to just composer; and moves it to /usr/bin
Then after that you should get output just using :

Code:
[andrew@darkstar Desktop]$ composer-V
bash: composer-V: command not found
[andrew@darkstar Desktop]$ composer -V
Composer version 2.8.2 2024-10-29 16:12:11
PHP version 8.3.13 (/usr/bin/php)
Run the "diagnose" command to get more detailed diagnostics output.

when you run set up command for spark make sure, you are at document root for your web application
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply
#5

(This post was last modified: 11-30-2024, 11:38 PM by 4usol.)

Hi, captain-sensible.

First of all, I would like to briefly say that I am very grateful that you help me understand things, which have much more to do with fundamental topics (because I'm currently trying to familiarize myself with all the different topics) than with direct questions about Codeigniter

So at first i've setup my configuration, so basicly the php version 8.2 is now the default version.

Here is the requestet info about composer version
"Composer version 2.8.3 2024-11-17 13:13:04"

Result of diagnose
"Composer version: 2.8.3
PHP version: 8.2.25
PHP binary path: /usr/local/php82/bin/php
OpenSSL version: OpenSSL 1.1.1w 11 Sep 2023
curl version: 7.74.0 libz 1.2.11 ssl OpenSSL/1.1.1w
zip: extension present, unzip present, 7-Zip not available"

After that i delete all files in my project folder, uplode the composer.phar and add codeigniter4/appstarter see:
" php composer.phar create-project codeigniter4/appstarter

Creating a "codeigniter4/appstarter" project at "./appstarter"
Installing codeigniter4/appstarter (v4.5.5)
- Installing codeigniter4/appstarter (v4.5.5): Extracting archive
Created project in /v2.4u.tools/appstarter
Loading composer repositories with package information
Updating dependencies
Lock file operations: 33 installs, 0 updates, 0 removals
- Locking codeigniter4/framework (v4.5.5)
- Locking fakerphp/faker (v1.24.1)
- Locking laminas/laminas-escaper (2.14.0)
- Locking mikey179/vfsstream (v1.6.12)
- Locking myclabs/deep-copy (1.12.1)
- Locking nikic/php-parser (v5.3.1)
- Locking phar-io/manifest (2.0.4)
- Locking phar-io/version (3.2.1)
- Locking phpunit/php-code-coverage (10.1.16)
- Locking phpunit/php-file-iterator (4.1.0)
- Locking phpunit/php-invoker (4.0.0)
- Locking phpunit/php-text-template (3.0.1)
- Locking phpunit/php-timer (6.0.0)
- Locking phpunit/phpunit (10.5.38)
- Locking psr/container (2.0.2)
- Locking psr/log (3.0.2)
- Locking sebastian/cli-parser (2.0.1)
- Locking sebastian/code-unit (2.0.0)
- Locking sebastian/code-unit-reverse-lookup (3.0.0)
- Locking sebastian/comparator (5.0.3)
- Locking sebastian/complexity (3.2.0)
- Locking sebastian/diff (5.1.1)
- Locking sebastian/environment (6.1.0)
- Locking sebastian/exporter (5.1.2)
- Locking sebastian/global-state (6.0.2)
- Locking sebastian/lines-of-code (2.0.2)
- Locking sebastian/object-enumerator (5.0.0)
- Locking sebastian/object-reflector (3.0.0)
- Locking sebastian/recursion-context (5.0.0)
- Locking sebastian/type (4.0.0)
- Locking sebastian/version (4.0.1)
- Locking symfony/deprecation-contracts (v3.5.1)
- Locking theseer/tokenizer (1.2.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 33 installs, 0 updates, 0 removals
- Installing psr/log (3.0.2): Extracting archive
- Installing laminas/laminas-escaper (2.14.0): Extracting archive
- Installing codeigniter4/framework (v4.5.5): Extracting archive
- Installing symfony/deprecation-contracts (v3.5.1): Extracting archive
- Installing psr/container (2.0.2): Extracting archive
- Installing fakerphp/faker (v1.24.1): Extracting archive
- Installing mikey179/vfsstream (v1.6.12): Extracting archive
- Installing sebastian/version (4.0.1): Extracting archive
- Installing sebastian/type (4.0.0): Extracting archive
- Installing sebastian/recursion-context (5.0.0): Extracting archive
- Installing sebastian/object-reflector (3.0.0): Extracting archive
- Installing sebastian/object-enumerator (5.0.0): Extracting archive
- Installing sebastian/global-state (6.0.2): Extracting archive
- Installing sebastian/exporter (5.1.2): Extracting archive
- Installing sebastian/environment (6.1.0): Extracting archive
- Installing sebastian/diff (5.1.1): Extracting archive
- Installing sebastian/comparator (5.0.3): Extracting archive
- Installing sebastian/code-unit (2.0.0): Extracting archive
- Installing sebastian/cli-parser (2.0.1): Extracting archive
- Installing phpunit/php-timer (6.0.0): Extracting archive
- Installing phpunit/php-text-template (3.0.1): Extracting archive
- Installing phpunit/php-invoker (4.0.0): Extracting archive
- Installing phpunit/php-file-iterator (4.1.0): Extracting archive
- Installing theseer/tokenizer (1.2.3): Extracting archive
- Installing nikic/php-parser (v5.3.1): Extracting archive
- Installing sebastian/lines-of-code (2.0.2): Extracting archive
- Installing sebastian/complexity (3.2.0): Extracting archive
- Installing sebastian/code-unit-reverse-lookup (3.0.0): Extracting archive
- Installing phpunit/php-code-coverage (10.1.16): Extracting archive
- Installing phar-io/version (3.2.1): Extracting archive
- Installing phar-io/manifest (2.0.4): Extracting archive
- Installing myclabs/deep-copy (1.12.1): Extracting archive
- Installing phpunit/phpunit (10.5.38): Extracting archive
9 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
26 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found."

Now i see, that there is a new subfolder named "appstarter" - i think i need it into the root folder - how i can change it on installation command?

So i've put all content of the "appstarter"folder into my root folder.

After that i installed shield by this: " php composer.phar require codeigniter4/shield

./composer.json has been updated
Running composer update codeigniter4/shield
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Locking codeigniter4/settings (v2.2.0)
- Locking codeigniter4/shield (v1.1.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing codeigniter4/settings (v2.2.0): Extracting archive
- Installing codeigniter4/shield (v1.1.0): Extracting archive
Generating optimized autoload files
26 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^1.1 for codeigniter4/shield
"

Now i see there is a new folder "vendor" - the same question, is it corretly or have i change this folder and if, how?
Reply
#6

(11-30-2024, 11:35 PM)4usol Wrote: Hi, captain-sensible.

First of all, I would like to briefly say that I am very grateful that you help me understand things, which have much more to do with fundamental topics (because I'm currently trying to familiarize myself with all the different topics) than with direct questions about Codeigniter

So at first i've setup my configuration, so basicly the php version 8.2 is now the default version.

Here is the requestet info about composer version
"Composer version 2.8.3 2024-11-17 13:13:04"

Result of diagnose
"Composer version: 2.8.3
PHP version: 8.2.25
PHP binary path: /usr/local/php82/bin/php
OpenSSL version: OpenSSL 1.1.1w  11 Sep 2023
curl version: 7.74.0 libz 1.2.11 ssl OpenSSL/1.1.1w
zip: extension present, unzip present, 7-Zip not available"

After that i delete all files in my project folder, uplode the composer.phar and add codeigniter4/appstarter see:
" php composer.phar create-project codeigniter4/appstarter

Creating a "codeigniter4/appstarter" project at "./appstarter"
Installing codeigniter4/appstarter (v4.5.5)
  - Installing codeigniter4/appstarter (v4.5.5): Extracting archive
Created project in /v2.4u.tools/appstarter
Loading composer repositories with package information
Updating dependencies
Lock file operations: 33 installs, 0 updates, 0 removals
  - Locking codeigniter4/framework (v4.5.5)
  - Locking fakerphp/faker (v1.24.1)
  - Locking laminas/laminas-escaper (2.14.0)
  - Locking mikey179/vfsstream (v1.6.12)
  - Locking myclabs/deep-copy (1.12.1)
  - Locking nikic/php-parser (v5.3.1)
  - Locking phar-io/manifest (2.0.4)
  - Locking phar-io/version (3.2.1)
  - Locking phpunit/php-code-coverage (10.1.16)
  - Locking phpunit/php-file-iterator (4.1.0)
  - Locking phpunit/php-invoker (4.0.0)
  - Locking phpunit/php-text-template (3.0.1)
  - Locking phpunit/php-timer (6.0.0)
  - Locking phpunit/phpunit (10.5.38)
  - Locking psr/container (2.0.2)
  - Locking psr/log (3.0.2)
  - Locking sebastian/cli-parser (2.0.1)
  - Locking sebastian/code-unit (2.0.0)
  - Locking sebastian/code-unit-reverse-lookup (3.0.0)
  - Locking sebastian/comparator (5.0.3)
  - Locking sebastian/complexity (3.2.0)
  - Locking sebastian/diff (5.1.1)
  - Locking sebastian/environment (6.1.0)
  - Locking sebastian/exporter (5.1.2)
  - Locking sebastian/global-state (6.0.2)
  - Locking sebastian/lines-of-code (2.0.2)
  - Locking sebastian/object-enumerator (5.0.0)
  - Locking sebastian/object-reflector (3.0.0)
  - Locking sebastian/recursion-context (5.0.0)
  - Locking sebastian/type (4.0.0)
  - Locking sebastian/version (4.0.1)
  - Locking symfony/deprecation-contracts (v3.5.1)
  - Locking theseer/tokenizer (1.2.3)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 33 installs, 0 updates, 0 removals
  - Installing psr/log (3.0.2): Extracting archive
  - Installing laminas/laminas-escaper (2.14.0): Extracting archive
  - Installing codeigniter4/framework (v4.5.5): Extracting archive
  - Installing symfony/deprecation-contracts (v3.5.1): Extracting archive
  - Installing psr/container (2.0.2): Extracting archive
  - Installing fakerphp/faker (v1.24.1): Extracting archive
  - Installing mikey179/vfsstream (v1.6.12): Extracting archive
  - Installing sebastian/version (4.0.1): Extracting archive
  - Installing sebastian/type (4.0.0): Extracting archive
  - Installing sebastian/recursion-context (5.0.0): Extracting archive
  - Installing sebastian/object-reflector (3.0.0): Extracting archive
  - Installing sebastian/object-enumerator (5.0.0): Extracting archive
  - Installing sebastian/global-state (6.0.2): Extracting archive
  - Installing sebastian/exporter (5.1.2): Extracting archive
  - Installing sebastian/environment (6.1.0): Extracting archive
  - Installing sebastian/diff (5.1.1): Extracting archive
  - Installing sebastian/comparator (5.0.3): Extracting archive
  - Installing sebastian/code-unit (2.0.0): Extracting archive
  - Installing sebastian/cli-parser (2.0.1): Extracting archive
  - Installing phpunit/php-timer (6.0.0): Extracting archive
  - Installing phpunit/php-text-template (3.0.1): Extracting archive
  - Installing phpunit/php-invoker (4.0.0): Extracting archive
  - Installing phpunit/php-file-iterator (4.1.0): Extracting archive
  - Installing theseer/tokenizer (1.2.3): Extracting archive
  - Installing nikic/php-parser (v5.3.1): Extracting archive
  - Installing sebastian/lines-of-code (2.0.2): Extracting archive
  - Installing sebastian/complexity (3.2.0): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (3.0.0): Extracting archive
  - Installing phpunit/php-code-coverage (10.1.16): Extracting archive
  - Installing phar-io/version (3.2.1): Extracting archive
  - Installing phar-io/manifest (2.0.4): Extracting archive
  - Installing myclabs/deep-copy (1.12.1): Extracting archive
  - Installing phpunit/phpunit (10.5.38): Extracting archive
9 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
26 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found."

Now i see, that there is a new subfolder named "appstarter" - i think i need it into the root folder - how i can change it on installation command?

So i've put all content of the "appstarter"folder into my root folder.

After that i installed shield by this: " php composer.phar require codeigniter4/shield

./composer.json has been updated
Running composer update codeigniter4/shield
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
  - Locking codeigniter4/settings (v2.2.0)
  - Locking codeigniter4/shield (v1.1.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing codeigniter4/settings (v2.2.0): Extracting archive
  - Installing codeigniter4/shield (v1.1.0): Extracting archive
Generating optimized autoload files
26 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
No security vulnerability advisories found.
Using version ^1.1 for codeigniter4/shield
"

Now i see there is a new folder "vendor" - the same question, is it corretly or have i change this folder and if, how?
It looks like you've done a great job setting up CodeIgniter 4 and installing additional components like Shield using Composer. I'll address your questions and concerns in detail:

1. Moving
Code:
appstarter
to the Root Directory
By default, the
Code:
php composer.phar create-project codeigniter4/appstarter
command installs the application in a subfolder (e.g.,
Code:
appstarter
). If you want the files directly in the root folder during installation, you can specify the directory name like this:
bash
Code:
php composer.phar create-project codeigniter4/appstarter .
Here, the
Code:
.
indicates the current directory (root directory). This will prevent creating the
Code:
appstarter
subfolder.
Since you've already moved the contents of the
Code:
appstarter
folder to the root directory manually, you don’t need to reinstall it. Just ensure that your structure looks like this:
bash
Code:
/app
/public
/vendor
/writable
/composer.json
...

2. The
Code:
vendor
Folder
The
Code:
vendor
folder is created by Composer and is critical to your project. It contains all the third-party packages (including CodeIgniter itself) and the autoloader file.
What to Do with the
Code:
vendor
Folder?
You should not move or rename the
Code:
vendor
folder. It must stay in its current location in the root directory of your project because:
  • The autoloading system relies on the
    Code:
    vendor
    folder.
  • Composer manages this folder automatically.
If you move the
Code:
vendor
folder, your application may break unless you update paths manually, which is not recommended.

3. Installing Shield and Its
Code:
vendor
Dependencies
When you installed Shield using:
bash
Code:
php composer.phar require codeigniter4/shield
It added Shield's dependencies to the
Code:
vendor
folder. This behavior is expected and ensures Shield works seamlessly with your project.

4. Final Structure After Setup
After installing all components and moving files, your project structure should resemble the following:
python
Code:
/app            (Application files, such as Controllers, Models, Views)
/public        (Public-facing files like index.php, assets, etc.)
/vendor        (Managed by Composer, do not modify manually)
/writable      (For logs, cache, and other writable data)
/composer.json  (Composer's dependency file)
/composer.lock  (Composer's lock file for dependencies)
...

5. Recommendations
  • Do not move the
    Code:
    vendor
    folder. It's managed by Composer and should remain in the root directory.
  • Use the
    Code:
    create-project
    command with
    Code:
    .
    for future projects to avoid creating unnecessary subfolders.
  • Ensure
    Code:
    public
    is set as the webroot in your server configuration. For example, in Apache, update your
    Code:
    DocumentRoot
    to point to the
    Code:
    public
    folder.
If you follow these guidelines, your CodeIgniter 4 application will be set up correctly and run without issues. Let me know if you need further clarification!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB