Project template for starting your new project based on the Bug Catcher

1.0.1 2024-09-02 19:57 UTC

This package is auto-updated.

Last update: 2024-11-10 05:51:26 UTC


README

Tests

Catch every bug in all your PHP applications in one place


Installation

By composer

composer create-project php-bug-catcher/skeleton your-project-name

Manual

Create blank symfony project

composer create-project symfony/skeleton:"7.1.*" bug-catcher

Add depenedencies

composer require php-bug-catcher/bug-catcher

Enable bundle if not already enabled

//config/bundles.php
return [
    ...
    BugCatcher\BugCatcherBundle::class => ['all' => true],
    ...
];

Configuration

setup packages

#config/packages/twig.yaml
twig:
  #...
  form_themes: [ '@EasyAdmin/symfony-form-themes/bootstrap_5_layout.html.twig' ]
  globals:
    logo: '%logo%'
    app_name: '%env(APP_NAME)%'
#config/packages/twig_component.yaml
twig_component:
  #...
  defaults:
    #...
    BugCatcher\Twig\Components\: '@BugCatcher/components/'
#config/packages/webpack_encore.yaml
webpack_encore:
  #...
  builds:
    bug_catcher: '%kernel.project_dir%/public/bundles/bugcatcher/'
framework:
  #...
  assets:
    packages:
      app:
        json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
      bug_catcher:
        json_manifest_path: '%kernel.project_dir%/public/bundles/bugcatcher/manifest.json'

Security

follow the instructions in the Symfony docs Modify these:

#config/packages/security.yaml
security:
  #...
  providers:
    app_user_provider:
      entity:
        class: BugCatcher\Entity\User
        property: email
  firewalls:
    #...
    api:
      pattern: ^/api/
      stateless: true
    main:
      #...
      provider: app_user_provider
      form_login:
        login_path: bug_catcher.security.login
        check_path: bug_catcher.security.login
        enable_csrf: true
      logout:
        path: bug_catcher.security.logout
  access_control:
    - { path: ^/login$, role: PUBLIC_ACCESS }
    - { path: ^/api, roles: PUBLIC_ACCESS }
    - { path: ^/admin, roles: ROLE_ADMIN }
    - { path: ^/detail, roles: ROLE_DEVELOPER }
    - { path: ^/_components/LogList/clearAll, roles: ROLE_DEVELOPER }
    - { path: ^/_components/LogList/clearOne, roles: ROLE_DEVELOPER }
    - { path: ^/, roles: ROLE_CUSTOMER }
  role_hierarchy:
    ROLE_ADMIN: ROLE_DEVELOPER
    ROLE_DEVELOPER: ROLE_CUSTOMER
    ROLE_CUSTOMER: ROLE_USER
#config/packages/doctrine.yaml
doctrine:
  orm:
    #...
    dql:
      string_functions:
        TYPE: BugCatcher\Extension\DQL\TypeFunction
#config/packages/api_platform.yaml
api_platform:
  #...
  formats:
    #...
    json: [ 'application/json' ]

Routes

#config/routes/bug_catcher.yaml
_bug_catcher:
  resource: "@BugCatcherBundle/config/routes.php"
  prefix: /

Download icons

php bin/console ux:icons:import pajamas:hamburger covid:virus-lab-research-magnifier-1 clarity:archive-line game-icons:magic-broom