rshop/app

RSHOP skeleton app

Installs: 12

Dependents: 0

Suggesters: 0

Security: 0

Type:project

v2.0.0 2025-08-04 07:56 UTC

README

Installation

1. Create DB ( PHP my Admin ) and Import DB dump

sh ~/Devel/scripts/db_import/import_db.sh <DB_NAME> ~/Devel/db/<DB_DUMP_FILE>.sql

If you are working on svetnapojov and get errors run mysql -f -u root -proot svetnapojov

In case of errors remove this line from the dump file:

DEFINER=`<USERNAME>`@`localhost` SQL SECURITY DEFINER

2. Composer install

When prompted with Set folder permissions and create symlinks if needed? Run only with sufficient privileges [Y,n]? accept. In case you failed to do so you can still try again with bin/cake rshop install symlink.

Decline the remaining prompts.

composer i

3. Rshop update

bin/cake rshop update

4. Set ROOT_PATH env

5. Build and Install

bin/fe i

6. Create admin user

bin/cake rshop:admin-users create

7. Reindex - if project uses elasticsearch

bin/cake rshop:reindex

Dummy data

If there is no data available, you can run seed files for dummy data. Use them only in development phase before the project goes to production.

config/seed.php
  • DEPRECEATED! - use migrations for that
  • bin/cake BasicSeed.basic_seed - for boxes and banner places
    config/seed_dev.php
  • bin/cake BasicSeed.basic_seed -d - for dummy data & box items/subitems

Migration to Vite - Changelog

Global variables

I would like this to be only temporary since in my opinion explicit imports are more understandable and as we migrate to Typescript there will be a lot of errors since the variables are not imported in the file

Accessing ENV vars

Using Vite we have to access env vars like so:

import.meta.env.[ENV_NAME]

When you want to get TS suggestion for new ENV variable, you have to add it to vite-env.d.ts file.

Libs

For libraries like jQuery, the variables are set in /resources/js/common/commonLibs/index.js, since the file is preloaded.

Common Frontend

For variables primarily from vendor I updated each of the files, where I added to them default export and inicialization of the global variable in window. See /resources/js/common/commonFrontend/index.js

Vite

Structure of the file

  1. Plugins

    • Vue - plugin for vue
    • LiveReload - used for live reload of the .php and .ctp files
  2. Build

    • For build we have scripts which take all main files. For CSS that's import.scss and for JS it's index.js. So every file named like so will be included in the build.
  3. Aliases

    • Specified aliases for imports

Importing CSS and JS into PHP

Importing of CSS and JS is happening in base.ctp file. The HtmlHelper for these imports is slightly modified. Now instead of the path to the file we only specify "keys" like so:

echo $this->Html->script('[PATH IS EMPTY]', [OPTIONS], ['common', 'commonLibs']);

So as you see in the example above we specified we want file from common folder and specifically we want commonLibs file. The modified HtmlHelper then finds file that corresponds to these keys and returns path to it.

When the DEBUG env variable in .env is set to true the base file path is set to http://localhost:3000 and path is set to file itself - that is so that the Hot module reload of Vite is working during development.

Running the app

After default setup of the app the only thing left to do is to run

npm run dev

Troubleshooting

Admin has no styles and/or images are not loading

In this case running following commands should do the job:

bin/fe upd:admin and bin/cake rshop install symlink

Usefull commands

  • composer install
  • bin/cake rshop update
  • bin/fe i
  • bin/cake rshop install symlink

project migrations

  • bin/cake migrations create MigrationName - new migration for project
  • bin/cake migrations migrate - run project migrations
  • bin/cake migrations rollback - rollback of the last project migration
  • bin/cake migrations mark_migrated 20240419093004 - mark migration as migrated

    rshop/admin migrations

  • bin/cake migrations create MigrationName --plugin=Rshop/Admin - new migration for rshop/admin
  • bin/cake rshop update migrate - run rshop/admin migrations
  • bin/cake rshop update rollback - rollback of the last rshop/admin migration
  • bin/cake migrations mark_migrated 20240419093004 -p Rshop/Admin - mark migration in rshop/admin as migrated

    cache

  • bin/cake orm_cache clear - db cache
  • bin/cake cache clear_all - clear all
  • bin/cake cache clear cacheName - clear individual cache
    • _cake_core_
    • _cake_model_
    • bin/cake cache list_prefixes - list all available prefixes