symfony4 Installation and Creation Project [2019]

symfony4 Installation and Creation Project

symfony4 installation

Environment: On windows 10

Install compposer and select a directory to execute the following commands to create a symfony project

// Creating a project named my-project will be created in the current directory
$ composer create-project symfony/website-skeleton my-project

Creation takes a long time, waiting for 3-5 minutes




Installation is completed as shown in Figure 1
Next start the project

Start the symfony4 project

$ cd my-project
// Start the project by executing the following command
$ php bin/console server:run

Open the browser and visit http://localhost:8000/. If everything works, you will see the welcome page. Later, when you have finished your work, press Ctrl+c on the terminal to stop the service.

symfony4 Framework Project Directory

├── bin                      # Executable File Directory -d
│   ├── console              # Command line entry files are used to execute many commands, such as database operations, caching operations, viewing routes, services, etc..
│   └── phpunit              # Favicon
├── config                   # configure directory -d
│   ├── packages 			 # Follow that each environment has a separate configuration file directory -d
│   │   ├── dev
│   │   ├── prod
│   │   ├── test
│   │   ├── cache.yaml
│   │   ├── doctrine_migrations.yaml
│   │   ├── doctrine.yaml
│   │   ├── framework.yaml
│   │   ├── routing-yaml
│   │   ├── security.yaml
│   │   ├── sensio_ framework_extra.yaml
│   │   ├── swiftmailer.yaml
│   │   ├── translation.yaml
│   │   ├── twig.yaml 
│   │   └── validator.yaml
│   ├── routes				 # Routing Profile -d
│   │   └── dev
│   │   │   ├── twig.yaml 
│   │   │   └── web_profiler.yaml
│   │   └── annotations.yaml
│   ├── bootstrap. php
│   ├── bundles. php   		 # Similar4Pre-version bundle Registration, need to use bundle You have to register here to use it.
│   ├── routes. yaml   		 # Routing Profile
│   └── services. yaml       # Service Profile
├── public                   # Entry file -d
│   └── index.php            # Project Entry Document
├── src                      # Application Catalogue (Application is not necessarily necessary src The directory can be found in composer.json Of autoload Department modification)
│   ├── Controller           # Controller File Directory -d
│   ├── Entity               # Database Entity File Directory -d
│   ├── Migrations			 # Database migration directory -d
│   ├── Repository 			 # Data Entity Operations Class -d
│   └── Kernel.php			 # The symfony core, request response, is handled here, including routing, service containers, dependencies, etc.
├── templates                # The templates directory is created automatically after installing the twig component and is where to store the twig template -d
├── tests                    # ContainPHPWritten and symfony Unit and Functional Testing Compatible with Test Framework.When the project is initialized, symfony Some basic tests will be built automatically.
├── translations             # 
├── var                      # Caching, Data, Logging
│   ├── cache                # Cache directory -d
│   └── log      			 # The log directory stores the log files of the applications generated by symfony. -d
├── vendor                   # assembly vendor A directory is a directory where third-party components are placed. Generally, files in this directory are passed through composer To manage. Code that won't be touched during development(Debugging is not excluded)
├── .env                     # shell The script, which holds some configurations(APP_ENV,doctrine,secret etc.)
├── .env.test                # 
├── .gitignore               # 
├── composerjson             # 
├── composer.lock            # 
├── phpunit.xml.dist         # 
├── README.md
└── symfony.lock

dev Environmental Science, symfony Loading order
config/packages/*
config/packages/dev/*
config/services.yaml
config/services_dev.yaml

//Some files are added after installing the corresponding components, such as annotations.yaml, doctrine.yaml, twig.yaml

The command line of symfony4

// Execute the following commands to view project instructions
$ php bin/console
Symfony 4.3.3 (env: dev, debug: true)

Usage:
  command [options] [arguments]

Options:
  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -e, --env=ENV         The Environment name. [default: "dev"]
      --no-debug        Switches off debug mode.
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output,2 for more verbose output and 3 for debug

Available commands:
  about                                   Displays information about the current project
  help                                    Displays help for a command
  list                                    Lists commands
 assets
  assets:install                          Installs bundles web assets under a public directory
 cache
  cache:clear                             Clears the cache
  cache:pool:clear                        Clears cache pools
  cache:pool:delete                       Deletes an item from a cache pool
  cache:pool:list                         List available cache pools
  cache:pool:prune                        Prunes cache pools
  cache:warmup                            Warms up an empty cache
 config
  config:dump-reference                   Dumps the default configuration for an extension
 debug
  debug:autowiring                        Lists classes/interfaces you can use for autowiring
  debug:config                            Dumps the current configuration for an extension
  debug:container                         Displays current services for an appli
cation
  debug:event-dispatcher                  Displays configured listeners for an a
pplication
  debug:form                              Displays form type information
  debug:router                            Displays current routes for an application
  debug:swiftmailer                       Displays current mailers for an application
  debug:translation                       Displays translation messages informat
ion
  debug:twig                              Shows a list of twig functions, filters, globals and tests
 doctrine
  doctrine:cache:clear-collection-region  Clear a second-level cache collectionregion
  doctrine:cache:clear-entity-region      Clear a second-level cache entity region
  doctrine:cache:clear-metadata           Clears all metadata cache for an entity manager
  doctrine:cache:clear-query              Clears all query cache for an entity manager
  doctrine:cache:clear-query-region       Clear a second-level cache query region
  doctrine:cache:clear-result             Clears result cache for an entity manager
  doctrine:cache:contains                 Check if a cache entry exists
  doctrine:cache:delete                   Delete a cache entry
  doctrine:cache:flush                    [doctrine:cache:clear] Flush a given cache
  doctrine:cache:stats                    Get stats on a given cache provider
  doctrine:database:create                Creates the configured database
  doctrine:database:drop                  Drops the configured database
  doctrine:database:import                Import SQL file(s) directly to Database.
  doctrine:ensure-production-settings     Verify that Doctrine is properly configured for a production environment
  doctrine:generate:entities              [generate:doctrine:entities] Generates entity classes and method stubs from your mapping information
  doctrine:mapping:convert                [orm:convert:mapping] Convert mapping information between supported formats
  doctrine:mapping:import                 Imports mapping information from an existing database
  doctrine:mapping:info
  doctrine:migrations:diff                [diff] Generate a migration by comparing your current database to your mapping information.
  doctrine:migrations:dump-schema         [dump-schema] Dump the schema for your database to a migration.
  doctrine:migrations:execute             [execute] Execute a single migration version up or down manually.
  doctrine:migrations:generate            [generate] Generate a blank migration class.
  doctrine:migrations:latest              [latest] Outputs the latest version number
  doctrine:migrations:migrate             [migrate] Execute a migration to a specified version or the latest available version.
  doctrine:migrations:rollup              [rollup] Rollup migrations by deleting all tracked versions and insert the one version that exists.
  doctrine:migrations:status              [status] View the status of a set of migrations.
  doctrine:migrations:up-to-date          [up-to-date] Tells you if your schema is up-to-date.
  doctrine:migrations:version             [version] Manually add and delete migration versions from the version table.
  doctrine:query:dql                      Executes arbitrary DQL directly from the command line
  doctrine:query:sql                      Executes arbitrary SQL directly from the command line.
  doctrine:schema:create                  Executes (or dumps) the SQL needed togenerate the database schema
  doctrine:schema:drop                    Executes (or dumps) the SQL needed todrop the current database schema
  doctrine:schema:update                  Executes (or dumps) the SQL needed toupdate the database schema to match the current mapping metadata
  doctrine:schema:validate                Validate the mapping files
 lint
  lint:twig                               Lints a template and outputs encountered errors
  lint:xliff                              Lints a XLIFF file and outputs encountered errors
  lint:yaml                               Lints a file and outputs encountered errors
 make
  make:auth                               Creates a Guard authenticator of different flavors
  make:command                            Creates a new console command class
  make:controller                         Creates a new controller class
  make:crud                               Creates CRUD for Doctrine entity class
  make:entity                             Creates or updates a Doctrine entity c
lass, and optionally an API Platform resource
  make:fixtures                           Creates a new class to load Doctrine f
ixtures
  make:form                               Creates a new form class
  make:functional-test                    Creates a new functional test class
  make:migration                          Creates a new migration based on database changes
  make:registration-form                  Creates a new registration form system
  make:serializer:encoder                 Creates a new serializer encoder class
  make:serializer:normalizer              Creates a new serializer normalizer class
  make:subscriber                         Creates a new event subscriber class
  make:twig-extension                     Creates a new Twig extension class
  make:unit-test                          Creates a new unit test class
  make:user                               Creates a new security user class
  make:validator                          Creates a new validator and constraint class
  make:voter                              Creates a new security voter class
 router
  router:match                            Helps debug routes by simulating a path info match
 security
  security:encode-password                Encodes a password.
 server
  server:dump                             Starts a dump server that collects and displays dumps in a single place
  server:log                              Starts a log server that displays logs in real time
  server:run                              Runs a local web server
  server:start                            Starts a local web server in the background
  server:status                           Outputs the status of the local web server
  server:stop                             Stops the local web server that was started with the server:start command
 swiftmailer
  swiftmailer:email:send                  Send simple email message
  swiftmailer:spool:send                  Sends emails from the spool
 translation
  translation:update                      Updates the translation file

Hello! This is the first time you have used the Markdown editor to display a welcome page. If you want to learn how to use the Markdown editor, you can read this article carefully and learn about the basic grammar of Markdown.

New changes

We have developed some functions and grammar support for Markdown Editor. In addition to the standard Markdown Editor function, we have added the following new functions to help you write blogs with it:

  1. New interface design will bring a new writing experience.
  2. Set up your favorite code highlighting style in the Creation Center. Markdown displays the selected highlighting style of the code slice.
  3. Adding drag and drop function, you can drag and drop local pictures directly to the editing area for direct display.
  4. New KaTeX Mathematical Formula Grammar;
  5. Added mermaid grammar to support Gantt chart 1 Function;
  6. The function of multi-screen editing Markdown articles is added.
  7. The functions of focus writing mode, preview mode, concise writing mode and synchronous roller settings in left and right areas are added. The function buttons are located in the middle of editing area and preview area.
  8. Added checklist function.

Function shortcut key

Undo: Ctrl/Command+Z
Redo: Ctrl/Command+Y
Coarsening: Ctrl/Command+B
Italics: Ctrl/Command+I
Title: Ctrl/Command+Shift+H
Unordered list: Ctrl/Command+Shift+U
Ordered list: Ctrl/Command + Shift + O
Checklist: Ctrl/Command + Shift + C
Insert code: Ctrl/Command + Shift + K
Insert links: Ctrl/Command+Shift+L
Insert picture: Ctrl/Command+Shift+G
Find: Ctrl/Command+F
Replacement: Ctrl/Command+G

Reasonable creation of headings helps to generate directories

Type # once directly and press space to generate a level 1 title.
Enter # twice and press space to generate level 2 headings.
By analogy, we support Title 6. Help to use TOC grammar to generate a perfect directory.

How to Change the Style of Text

Emphasizing Text and Emphasizing Text

Coarsened text

Markup text

Delete text

Reference text

H_2O is a liquid.

The result of 210 operation is 1024.

Insert links and pictures

Links: link.

Pictures:

Pictures with size:

Pictures in the middle:

Centralized and sized picture:

Of course, in order to make users more convenient, we have added drag and drop function.

How to insert a beautiful piece of code

go Blog Settings Page, choose a highlighted style of your favorite code slice, the following shows the same highlighted code slice.

// An highlighted block
var foo = 'bar';

Generate a list that suits you

  • project
    • project
      • project
  1. Item 1
  2. Item 2
  3. Item 3
  • Planning tasks
  • Complete tasks

Create a table

A simple table is created in this way:

project Value
Computer $1600
Mobile phone $12
catheter $1

Setting content in the middle, left and right

Use: -------: Centralize
Use: --------- Left
Use --------------: Right

Column 1 Column 2 Column 3
The first column is in the middle. The second column is on the right. The third column is on the left.

SmartyPants

SmartyPants converts ASCII punctuation characters into "smart" printed punctuation HTML entities. For example:

TYPE ASCII HTML
Single backticks 'Isn't this fun?' 'Isn't this fun?'
Quotes "Isn't this fun?" "Isn't this fun?"
Dashes -- is en-dash, --- is em-dash – is en-dash, — is em-dash

Create a custom list

Markdown Text-to-HTML conversion tool Authors John Luke

How to create a footnote

A text with footnotes. 2

Annotations are also essential.

Markdown converts text to HTML.

KaTeX Mathematical Formula

You can use Rendering LaTeX Mathematical Expressions KaTeX:

Gamma formula shows_(n)=(n_1)!N < N Gamma(n)=(n-1)!Quad_for all N_in_mathbb N_(n)=(n_1)!N < N is through Euler integral

Γ(z)=∫0∞tz−1e−tdt&ThinSpace;. \Gamma(z) = \int_0^\infty t^{z-1}e^{-t}dt\,. Γ(z)=∫0∞​tz−1e−tdt.

You can find more information about LaTeX mathematical expressions. here.

New Gantt Chart features to enrich your articles

Mon 06Mon 13Mon 20 Has Completed Ongoing Plan 1 and Plan 2 Existing Tasks Adding GANTT diagram functionality to mermaid
  • About Gantt Grammar, Reference here,

UML diagrams

You can use UML diagrams for rendering. Mermaid For example, a sequence diagram is generated below:

Hello, Zhang San Li Si Wang Wu! Li Si, how are you doing recently? How are you doing recently, Wang Wu? I'm fine, thank you! I'm fine, thank you! Li Si has been thinking for a long time, and the words are too long to fit in one line. Looking at Wang Wu... very good... Wang Wu, how are you? Zhang San, Li Si, Wang Wu?

This will produce a flow chart. :

link
Rectangle
circular
Rounded rectangle
diamond
  • For Mermaid grammar, see here,

FLowchart flow chart

We will still support flowchart flow charts:

Created with Rapha l 2.2.0 to start my operation confirmation? End yesno
  • Reference to Flowchart flow chart grammar here.

Export and import

export

If you want to try using this editor, you can edit this article at will. When you have finished writing an article, find the article export in the toolbar above and generate A. md file or. html file for local saving.

Import

If you want to load A. md file that you have written, you can choose the import function in the toolbar above to import the file with the corresponding extension.
Continue your creation.

  1. mermaid grammar description ↩︎

  2. Explanation of footnotes ↩︎

Keywords: Database PHP SQL Web Server

Added by ainoy31 on Thu, 15 Aug 2019 15:05:20 +0300