Code Monkey home page Code Monkey logo

symfony-docs's Introduction

The official Symfony Documentation

Online version | Components | Screencasts

Contributing

We love contributors! For more information on how you can contribute, please read the Symfony Docs Contributing Guide.

Important

Use 5.4 branch as the base of your pull requests, unless you are documenting a feature that was introduced after Symfony 5.4 (e.g. in Symfony 7.1).

Build Documentation Locally

This is not needed for contributing, but it's useful if you would like to debug some issue in the docs or if you want to read Symfony Documentation offline.

$ git clone [email protected]:symfony/symfony-docs.git

$ cd symfony-docs/
$ cd _build/

$ composer install

$ php build.php

After generating docs, serve them with the internal PHP server:

$ php -S localhost:8000 -t output/

Browse http://localhost:8000 to read the docs.

symfony-docs's People

Contributors

94noni avatar alamirault avatar alexandre-daubois avatar atailouloute avatar bicpi avatar cordoval avatar dbu avatar dunglas avatar fabpot avatar gnito-org avatar heahdude avatar ifdattic avatar javiereguiluz avatar jderusse avatar lyrixx avatar mryamous avatar nicolas-grekas avatar noniagriconomie avatar nyholm avatar oskarstark avatar richardmiller-zz avatar sebpacz avatar sgoettschkes avatar stof avatar thomaslandauer avatar weaverryan avatar webmozart avatar wouterj avatar xabbuh avatar yceruto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

symfony-docs's Issues

Docn on extending bundles and the components within a bundle

From the templating chapter of the book:

"In Symfony2, almost every part of a bundle can be overridden so that you can use and customize it for your specific application. "

After searching far and wide, ie. the book, cookbook, forum, google, etc. there does not seem too much meat beyond the brief statement above on how to accomplish this.

The references I know about so far are:

http://symfony.com/doc/2.0/book/templating.html#overriding-bundle-templates
http://symfony.com/doc/current/cookbook/event_dispatcher/class_extension.html
http://symfony.com/doc/current/cookbook/event_dispatcher/method_behavior.html
https://groups.google.com/forum/#!topic/symfony-users/o1hj4tQZB28

In particular, one might need to know how to extend things like: bundle controllers, models, entities, validation rules, routes, config settings, services, service extensions, forms, etc.

Keep up the great work on the documentation. It is really starting to take shape.

Little issue in Cookbook » How to force routes to always use HTTPS

Hi,

I was reading the new released security documentation and just found a little issue in one example. The issue is found at cookbook/routing/scheme.rst.

Here is the current text

# If the current scheme is HTTPS
{{ path('secure') }}
# generates /secure

# If the current scheme is HTTP
{{ path('secure') }}
# generates https://example.com/secure

and should be like:

# If the current scheme is HTTP
{{ path('secure') }}
# generates /secure

# If the current scheme is HTTPS
{{ path('secure') }}
# generates https://example.com/secure

Notice the swap between HTTP/HTTPS, as the generated https schema is while using https, not http (well, I guess :-D)

Some Mac hints

There's a huge amount of people developing with Symfony on the Mac, often using the default Snow Leopard PHP install.

By defauly OS X lacks APC, MongoDB and memcache.
Fortunately, installing these extensions is VERY easy and hassle-free with brew.

brew install apc mongo-php memcache-php

A lot of people are put off with messing around with compiling/installing PHP extensions, so the barrier to entry is increased.
Might wanna add a cookbook entry for this and other Mac tricks (textmate bundles, etc)

Mention cache in translation page

I got bit by this so I thought I'd mention it. I added FOW\UserBundle to my app after I'd been working on other pieces. I found the strings on FOSUB's stock login page and others were not being translated. I found I needed to add the config entry to enable translation but that didn't fix the issue. I needed to clear my cache before the change was applied. Perhaps a little blurb suggesting "cache:clear" next to the instructions for adding the config entry is in order?

Development environment in Creating Pages in Symfony2

This chapter uses the development environment in order to show how to create pages in Symfony2:

http://localhost/app_dev.php/hello/Symfony

But in the chapter, instead of editing the routing_dev.yml (the one used by the development environment), we are told to edit the routing.yml, which could be confusing:

app/config/routing.yml

homepage:
pattern: /
defaults: { _controller: FrameworkBundle:Default:index }

hello:
resource: "@AcmeStudyBundle/Resources/config/routing.yml"

So I was wondering if this could be a mistake or if I'm missing something here.

[Security] Implementing Serializable in User object

We should probably add an example, or a note to the documentation showing how to implement Serializable in the user object. This seems to be a common pain point considering the number of threads that have been created on this topic.

Error in Forms Section of Symfony Book

In the book it states, that you can call the following from your controller class:
$form = $this->createFormBuilder($product)

but this function does not exists. Perhaps one has to add some configuration, but it should be stated in the book.

Instead I think you have to call

$factory = $this->get('form.factory');
$form = $factory->create(new JobType(), $job);

Re-use of Doctrine's PDO connection for PDO session storage

On the PDO session storage cookbook entry (https://github.com/symfony/symfony-docs/blob/master/cookbook/configuration/pdo_session_storage.rst), we show how the connection information from Doctrine can be re-used for the PDO connection used by the session storage.

However, a better solution to this would be to actually re-use Doctrine's wrapped PDO connection (see @stof's comment here: #209 (comment)). I think this should be added to the chapter and should probably replace the section where we reference the Doctrine connection parameter placeholders.

"Twitter Auth" Cookbook Article for Security

The Security docs mention "authentication can be handled in any number of ways, including via a form login, X.509 certificate, or by authenticating the user via Twitter"

It would be cool to back this up with an example

Rework the bundles chapter

The bundles chapter is a little dry and focused on the bundle author. The original intention was:

  • Organization, configuration, best-practices, community bundles, how to document a bundle, etc.
  • Possibly also details on extending/overriding a bundle

For the most part, if we put details about bundles here, we can reference this chapter from elsewhere in the book. This chapter probably won't be terribly long.

entity Field Type : clarify required option

It is written that required option is only in order to set the new html5 "required option".

However it is not the case, because this option can also be use to add an empty value (or option) as it is written for choice field : "Adding an empty value" section of https://github.com/symfony/symfony-docs/blob/master/reference/forms/types/choice.rst.

Then this section should be simply copy to :
https://github.com/symfony/symfony-docs/blob/master/reference/forms/types/entity.rst

typo in "the book"

In the "Routing" chapter there is an error in the second code window in the third line.

namespace Acme/BlogBundle/Controller; // has wrong slashes

namespace Acme\BlogBundle\Controller; // use backslashes instead.

Form Component Workflow

I would love to see a technical breakdown of how forms work. The relationship between Factories, Builders, Types, and finally the Extensions that render them.

This isn't really a cookbook article. It would probably be an addendum to the existing core docs. Does anyone else think this would be a helpful addition to the current form documentation?

Showing the index on the site

the old symfony-reloaded.org website used to show the index generated by Sphinx. The symfony.com website does not seems to show it. It would be a good idea to add it back.

Book/Recipe & routing (segment_separators option)

I've trying finding documentation on this matter to no help so I'm writing to mention the issue. There is no documentation available on how to alter the segment separators for symfony2. I was trying to use an e-mail address as a slug for the route /account/{email} but as Stof on IRC mentioned the default are . and / so in other words e-mail would not be accepted. The behaviour can be altered per route though with a simple:

options: { segment_separators: ['/'] }

under the needed route.

I think this would be of benefit for others seeking this information too, so I think this should be added on the book, at the chapter on routing or a a new recipe for routing.

Missing Product entity declaration

In http://symfony.com/doc/current/book/doctrine.html

The create action added to the DefaultController of the AcmeStore bundle needs the use of the Product entity. Without it, it causes a fatal error : Fatal error: Class 'Acme\StoreBundle\Controller\Product' not found in /Users/jmaelstaf/Development/htdocs/sftest/src/Acme/StoreBundle/Controller/DefaultController.php on line 18

// src/Acme/StoreBundle/Controller/DefaultController.php
use Symfony\Component\HttpFoundation\Response;
**use Acme\StoreBundle\Entity\Product; //missing statement**
// ...

public function createAction()
{
    $product = new Product();
    $product->setName('A Foo Bar');
    $product->setPrice('19.99');
    $product->setDescription('Lorem ipsum dolor');

    $em = $this->get('doctrine')->getEntityManager();
    $em->persist($product);
    $em->flush();

    return new Response('Created product id '.$product->getId());
}

Document validation groups

This needs to be covered both with respect to validation as well as how to setup a form to validation against a specific group.

Updated out-dated Doctrine event listeners/subscribers doc

There's a cookbook article (or will be, upon merge of the doctrine branch) that contains details about hooking up event listeners and subscribers with Doctrine events. I believe that this document is horribly outdated (and should really be expanded as it's a fairly common requirement).

Add missing sections to the forms chapter

I think we're missing several things from the form chapter that are important, and I'd like to get a list of them here.

If you can think of things you'd like to see in the form documentation, please add them in the comments below.

Old pages not removed from symfony.com

Pages deleted during the refactorings of the doc are not removed from the online doc, which means that some outdated doc are still available on line (and potentially indexed by google).

Broken link in Cookbook

article: "How to Expose a Semantic Configuration"

section:"Creating an extension"

sentence: "To define a semantic configuration, create a Dependency Injection extension that extends Extension who's class name..."

The link to the api code file for "Extension" is broken, returns 404 not found.

Best practices: Dependency Injection

I thought that it might be a good cookbook article to write down some basic principles about using a DIC.

Here are some notes that I took:

  • Law of Demeter
  • Many people use the singleton pattern because it is so incredibly easy to access some data; however, this is a global state and should be recognized as an anti-pattern! DIC to the rescue!
    ---> Example of hierarchy built by DIC, which basically means: Bottom-Up approach, not top-down
  • Don't use Service Locator -> one time bootstrapping, that should be it! (However, there might be usecases for RAD - see the discussion on it)
  • keyword "new" is bad! if you use it: refactor!
  • Hollywood principle -> forces you to program against an interface, not a concrete implementation
  • Want to configure objects at runtime? Inject a Builder Object!
  • Advantage over factories: Factories may be static and need for testing some method to enable mocking; but as they're static, you must make sure that you tear everything down after your test. With DI, you don't need that!
  • Dependencies become obvious with DI and they are part of the API

ANTI-Patterns

  • Should I inject the container into my objects?
    --> No! This is an anti-pattern. None of your objects should be aware that something like a DIC even exists.

Examples:

Maybe one could give some example about using the DIC in a real use-case. Maybe one could show how to replace switch-statements (which obviously should never be used in OO code).

Doctrine 2 Behavioral Extensions

I think we definitely need a cookbook article on this.

There's a great blog post on some extensions here, but nothing in the context of symfony2 (that I could find). This is something everyone is sure to want to use.

The commands to setup de cache & logs directory is incorrect

On the documentation we can read that to setup our cache & log dir we need to issue this two commands.

sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
sudo chmod +a "yourname allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs

But on linux this command fails:

pate@christophe:/var/www/Sf2MCQ$ sudo chmod +a "www-data allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
chmod: mode invalide: `+a'
Pour en savoir davantage, faites: « chmod --help ».

Add "Extending Symfony" chapter

This chapter would include basic introductions into common extension points, such as hooking into core events, adding helpers/twig extensions, etc.

[Security] Add note about usernames defined in config

There should be an note that defining this:

security:
    providers:
         in_memory:
            users:
                70: { password: pass, roles: 'ROLE_USER' }
                user-name: { password: pass, roles: 'ROLE_USER' }

Will fail, and user should write something like instead:

security:
    providers:
         in_memory:
            users:
                - { name: 70, password: pass, roles: 'ROLE_USER' }
                - { name: user-name, password: pass, roles: 'ROLE_USER' }

Related issues symfony/symfony#1176 and symfony/symfony#1024.

Cookbook Article: Dynamic / Variable Form Fields

Similar to the Advanced Symfony Forms article in "More With Symfony", we should have a cookbook article illustrating how to have a dynamic number of fields / embedded forms that can be specified by the front end.

An example of this would be a form with multiple uploads, where a user can click "add another upload" and upload as many files (or up to a certain number of files) as they want. This could also be worked into the proposed Create Custom Field Type article.

Kudos to you guys for adding placeholders in the cookbook. I think that's a great idea!

Bad Glossary Link

The glossary link on the side of http://symfony.com/doc/current/ currently points to http://symfony.com/doc/current/glossary/index.html.

That's fine, except that all links inside the document now have incorrect paths. The intended link per sphinx should be:
http://symfony.com/doc/current/glossary.html (which works, but isn't the link used in the nav).

The link used in the nav should change, and the current glossary page should probably either go away or be a 301 redirect to the new glossary page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.