What is PSR in php ? Please explain with example

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
4
down vote

favorite












How PSR is useful in Magento 2 .



I learned



PSR-0 – Autoloader Standard
PSR-1 – Basic Coding Standard
PSR-2 – Coding Style Guide
PSR-3 – Logger Interface
PSR-4- Autoloader Standard


but I want to learn from example .
can anyone show me examples .







share|improve this question




























    up vote
    4
    down vote

    favorite












    How PSR is useful in Magento 2 .



    I learned



    PSR-0 – Autoloader Standard
    PSR-1 – Basic Coding Standard
    PSR-2 – Coding Style Guide
    PSR-3 – Logger Interface
    PSR-4- Autoloader Standard


    but I want to learn from example .
    can anyone show me examples .







    share|improve this question
























      up vote
      4
      down vote

      favorite









      up vote
      4
      down vote

      favorite











      How PSR is useful in Magento 2 .



      I learned



      PSR-0 – Autoloader Standard
      PSR-1 – Basic Coding Standard
      PSR-2 – Coding Style Guide
      PSR-3 – Logger Interface
      PSR-4- Autoloader Standard


      but I want to learn from example .
      can anyone show me examples .







      share|improve this question














      How PSR is useful in Magento 2 .



      I learned



      PSR-0 – Autoloader Standard
      PSR-1 – Basic Coding Standard
      PSR-2 – Coding Style Guide
      PSR-3 – Logger Interface
      PSR-4- Autoloader Standard


      but I want to learn from example .
      can anyone show me examples .









      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 23 at 8:59









      kunj

      2,3772420




      2,3772420










      asked Aug 23 at 8:59









      Jaykumar R

      212




      212




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote













          PSR stands for PHP Standards Recommendations, this is a code convention. Magento 2 uses PSR-1 and PSR-2 See https://www.php-fig.org/psr/ for the conventions and examples.



          An example is that you should write methods in camelCase and not with underscores, for example:



          public function my_method()

          // do something



          Should be:



          public function myMethod()

          // do something






          share|improve this answer






















          • can you show examples .
            – Jaykumar R
            Aug 23 at 9:16










          • @JaykumarR Added an example for you
            – R. Jansen
            Aug 23 at 9:40










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f239314%2fwhat-is-psr-in-php-please-explain-with-example%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          4
          down vote













          PSR stands for PHP Standards Recommendations, this is a code convention. Magento 2 uses PSR-1 and PSR-2 See https://www.php-fig.org/psr/ for the conventions and examples.



          An example is that you should write methods in camelCase and not with underscores, for example:



          public function my_method()

          // do something



          Should be:



          public function myMethod()

          // do something






          share|improve this answer






















          • can you show examples .
            – Jaykumar R
            Aug 23 at 9:16










          • @JaykumarR Added an example for you
            – R. Jansen
            Aug 23 at 9:40














          up vote
          4
          down vote













          PSR stands for PHP Standards Recommendations, this is a code convention. Magento 2 uses PSR-1 and PSR-2 See https://www.php-fig.org/psr/ for the conventions and examples.



          An example is that you should write methods in camelCase and not with underscores, for example:



          public function my_method()

          // do something



          Should be:



          public function myMethod()

          // do something






          share|improve this answer






















          • can you show examples .
            – Jaykumar R
            Aug 23 at 9:16










          • @JaykumarR Added an example for you
            – R. Jansen
            Aug 23 at 9:40












          up vote
          4
          down vote










          up vote
          4
          down vote









          PSR stands for PHP Standards Recommendations, this is a code convention. Magento 2 uses PSR-1 and PSR-2 See https://www.php-fig.org/psr/ for the conventions and examples.



          An example is that you should write methods in camelCase and not with underscores, for example:



          public function my_method()

          // do something



          Should be:



          public function myMethod()

          // do something






          share|improve this answer














          PSR stands for PHP Standards Recommendations, this is a code convention. Magento 2 uses PSR-1 and PSR-2 See https://www.php-fig.org/psr/ for the conventions and examples.



          An example is that you should write methods in camelCase and not with underscores, for example:



          public function my_method()

          // do something



          Should be:



          public function myMethod()

          // do something







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Aug 23 at 9:40

























          answered Aug 23 at 9:05









          R. Jansen

          707




          707











          • can you show examples .
            – Jaykumar R
            Aug 23 at 9:16










          • @JaykumarR Added an example for you
            – R. Jansen
            Aug 23 at 9:40
















          • can you show examples .
            – Jaykumar R
            Aug 23 at 9:16










          • @JaykumarR Added an example for you
            – R. Jansen
            Aug 23 at 9:40















          can you show examples .
          – Jaykumar R
          Aug 23 at 9:16




          can you show examples .
          – Jaykumar R
          Aug 23 at 9:16












          @JaykumarR Added an example for you
          – R. Jansen
          Aug 23 at 9:40




          @JaykumarR Added an example for you
          – R. Jansen
          Aug 23 at 9:40

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f239314%2fwhat-is-psr-in-php-please-explain-with-example%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          Long meetings (6-7 hours a day): Being “babysat” by supervisor

          Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

          Confectionery