Categories
PHP Symfony

Starting a custom CRM with Symfony 5

These are some of my notes on how to create a custom client-relationship manager (CRM) with Symfony5. I hope that this assists you in making a better project, let me know if you know of any better way to achieve this.

This is the steps to follow, which do not only work just for this type of application but for most full-size web applications built with Symfony 5:

  1. Download and install Symfony5 from https://symfony.com/download
  2. Start a new project with the following command
    1. symfony new crm –full

      1. Where crm is the project name
  3. Make sure it loads properly by starting the development server
    1. symfony serve -d

      1. If the command it’s successful it will provide you the HTTPS URL where the server is loaded onto
  4. Create a new default controller for the application
    1. php bin/console make:controller mainController

      1. You can use the following command to obtain a list of things that you can easily do via you CLI
        1. php bin/console list
  5. Open your new controller using your editor of preference to edit the new controller, in this, you will see the default code. The location will be
    1. src/Controller/MainController

  6. Start by changing the route URL to “/” and refreshing your development server. It should now show the new home page from the MainController
  7. Let’s install WebPack into our application by running
    1. composer require webpack-encore

    2. yarn install

  8. Let’s execute WebPack by running
    1. yarn watch

      1. It is very important you install webpack-encore before any other yarn dependency. Failure to do so will result in an error and in a problem when running the command
  9. After the build it’s complete, we can then add what will be our JavaScript and CSS main files it onto our main template file
    1. We do this by opening our base TWIG template file saved at
      1. templates/base.html.twig

    2. Then we add the following
      1. Into the stylesheets, block add
        1. {{ encore_entry_link_tags(‘app’) }}

      2. Into the JavaScript, block add
        1. {{ encore_entry_script_tags(‘app’) }}

    3. Once added refresh your app, you should see now a Gray background. If you check your console you should see a log with a message “Hello Webpack Encore!”
  10. Now let’s install Bootstrap so that we can give your application a better shell to be displayed in
    1. yarn add bootstrap –dev

  11. After it is installed, we need to add the following line into the top our CSS main file located at “assets/css/app.css”
    1. @import “~bootstrap”;

      1. If you refresh your application, you will notice the change in font size and style

 

This is how I would properly set up initially a Symfony5 CRM application. I hope it helps you, more lists are to follow to assist you in building your project.

Leave a Reply

Your email address will not be published. Required fields are marked *