Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Project Laravel Package

redaxo/project

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Steps

  1. Installation

    composer create-project redaxo/project my-redaxo-project
    
  2. First Use Case: Basic Page Creation

    • Access the REDAXO backend at /redaxo/ (default path).
    • Use the Page Editor to create a new page via the Pages module.
    • Insert content using the HTML Editor or YAML-based templates (located in /templates/).
  3. Key Directories to Explore

    • /core/ – REDAXO core files (avoid modifying directly).
    • /templates/ – Override default templates here.
    • /plugins/ – Install or develop custom plugins.
    • /lib/ – Custom libraries (e.g., helpers, utilities).
    • /config/ – Configuration files (e.g., config.php, config.yml).

Implementation Patterns

Workflow: Plugin Development

  1. Scaffold a Plugin

    php redaxo.php plugin:create my_plugin
    
    • Follow the plugin structure guide.
    • Key files:
      • my_plugin.php – Main plugin class (hooks, permissions).
      • /templates/ – Plugin-specific templates.
      • /lib/ – Custom logic.
  2. Hooks and Events

    • Use REDAXO’s hook system to extend functionality:
      // In my_plugin.php
      public static function onGetPage($page) {
          $page['content'] .= '<div>Custom content via hook</div>';
          return $page;
      }
      
    • Register hooks in my_plugin.php:
      public static function onInstall() {
          self::registerHook('getPage', 'onGetPage');
      }
      
  3. YAML Configuration

    • Define plugin settings in /config.yml:
      name: My Plugin
      version: 1.0.0
      author: Your Name
      permissions:
        - my_plugin_edit
      
  4. Frontend Integration

    • Use rex_view to render templates:
      rex_view::output('my_plugin/template.tpl', ['data' => $data]);
      
    • Access data via rex_request() or rex_db.

Workflow: Theming

  1. Override Default Templates

    • Copy /core/templates/ files to /templates/ (e.g., page.tpl).
    • Modify as needed; REDAXO will auto-detect overrides.
  2. Dynamic Content with rex_yaml_parser

    $content = rex_yaml_parser::parse($page['content']);
    // Manipulate $content array, then re-render:
    $page['content'] = rex_yaml_parser::toString($content);
    
  3. CSS/JS Assets

    • Place files in /files/ (e.g., /files/css/my_style.css).
    • Enqueue in templates:
      <link rel="stylesheet" href="{$rex['baseUrl']}files/css/my_style.css">
      

Workflow: Database Operations

  1. Use rex_db for Queries
    $articles = rex_db::factory()->getTable('rex_article')->where(['active' => 1])->findAll();
    
  2. Migrations
    • Use rex_sql for schema changes:
      rex_sql::factory()->setQuery('ALTER TABLE rex_article ADD COLUMN custom_field VARCHAR(255)');
      rex_sql::factory()->exec();
      

Gotchas and Tips

Pitfalls

  1. Core File Modifications

    • Avoid editing /core/ directly. Use plugins or template overrides.
    • Exception: Only modify /core/config.php for global settings (e.g., debug mode).
  2. Caching Quirks

    • REDAXO caches templates and database queries aggressively.
    • Clear cache after changes:
      php redaxo.php cache:clear
      
    • Use rex_cache to invalidate specific caches:
      rex_cache::set('my_cache_key', $data, ['lifetime' => 3600]);
      
  3. Plugin Dependencies

    • Ensure plugins are installed in the correct order (check requires in config.yml).
    • Debug dependency issues with:
      php redaxo.php plugin:list
      
  4. YAML Parsing Errors

    • Invalid YAML in config.yml or page content can break the backend.
    • Validate YAML with:
      composer require --dev symfony/yaml
      
      Then test parsing:
      use Symfony\Component\Yaml\Yaml;
      $config = Yaml::parseFile('/path/to/config.yml');
      

Debugging Tips

  1. Enable Debug Mode

    • Set in /config/config.php:
      $INSTALL['debug'] = true;
      
    • Logs are stored in /log/.
  2. Use rex_error for Logging

    rex_error::message('Debug message', 'my_plugin');
    
  3. Database Debugging

    • Enable SQL logging in config.php:
      $INSTALL['sql_debug'] = true;
      
    • Check /log/sql.log for queries.
  4. Frontend Debugging

    • Inspect rendered templates with browser dev tools.
    • Use rex_view::debug() to dump template variables:
      rex_view::debug($data);
      

Extension Points

  1. Custom Admin Modules

    • Extend the backend with rex_module:
      class my_module extends rex_module {
          public function run() {
              $this->addCssFile('my_module.css');
              $this->addJsFile('my_module.js');
              $this->includeTemplate('my_module.tpl');
          }
      }
      
  2. API Endpoints

    • Create RESTful routes via plugins:
      public static function onGetPage($page) {
          if (rex_request::cget('api') === 'my_endpoint') {
              return json_encode(['data' => 'response']);
          }
          return $page;
      }
      
  3. CLI Automation

    • Extend REDAXO’s CLI with custom commands:
      php redaxo.php my:custom_command
      
    • Define in /plugins/my_plugin/cli.php:
      rex_cli::addCommand('my:custom_command', function() {
          echo "Running custom command!";
      });
      
  4. Multilingual Support

    • Use rex_language for translations:
      $text = rex_language::getString('my_plugin::greeting');
      
    • Define translations in /languages/en.yml:
      greeting: "Hello, world!"
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle