Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
0CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
CertiF...
1CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Summary
2CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Summar...
3CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struct...
4CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struct...
5CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struct...
6CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struct...
7CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struct...
8CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struct...
9CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struct...
10CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Struc...
11CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Confi...
12CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Confi...
13CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Confi...
14CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Confi...
15CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Confi...
16CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Doctr...
17CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Doctr...
18CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Doctr...
19CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Doctr...
20CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Commo...
21CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Commo...
22CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Commo...
23CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Commo...
24CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Gener...
25CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Gener...
26CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Gener...
27CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Gener...
28CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Gener...
29CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Gener...
30CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Addit...
31CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Addit...
32CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
Addit...
33CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz
33
Th...
Nächste SlideShare
Wird geladen in …5
×

CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS

1.312 Aufrufe

Veröffentlicht am

Slides from my talk at CertiFUNcation 2017 about the best practices for extension developer using TYPO3 8 LTS

Veröffentlicht in: Internet
  • Hey guys! Who wants to chat with me? More photos with me here 👉 http://www.bit.ly/katekoxx
       Antworten 
    Sind Sie sicher, dass Sie …  Ja  Nein
    Ihre Nachricht erscheint hier

CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS

  1. 1. 0CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz CertiFUNcation 2017 Best Practices Extension Development for TYPO3 8 LTS
  2. 2. 1CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Summary
  3. 3. 2CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Summary Changes » Configuration Bootstrap » Doctrine » Fluid Standalone
  4. 4. 3CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure
  5. 5. 4CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure Directories » Classes » Configuration » Documentation » Resources » Tests
  6. 6. 5CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure Classes » Home of your PHP files » Common subfolders: » Controller » Domain » Model » Repository » Hooks » Plugin » Service » ViewHelpers
  7. 7. 6CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure Configuration » FlexForms » XML files used to make extension plugins configurable » TCA » configuration for own extension tables; file names supposed to equal table name; an array has to be returned » subfolder: Overrides » contains general table changes for non-extension tables » TSconfig » contains page and/or user TypoScript configuration files » TypoScript » constants.typoscript » setup.typoscript
  8. 8. 7CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure Documentation » user manual » reStructuredText (ReST) files » typical files: » Includes.txt » Index.rst » Settings.yml » can be rendered by using EXT:sphinx
  9. 9. 8CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure Resources » Private » Language – XLF files for your language labels » Layouts – HTML files for Fluid Templates » Partials – HTML files for Fluid Templates » Php – external PHP-Code (e.g. phar files, libraries) » Templates – HTML files for Fluid » TypeScript – TS files for JavaScript compiling » Public » Css – CSS Stylesheet files » Fonts – font files used in Stylesheet (e.g. EOT, SVG, TTF, WOFF) » Icons – Icons used in Frontend and/or Backend » Images – Images used in Frontend and/or Backend » JavaScript – JS files used in Frontend and/or Backend
  10. 10. 9CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure Tests » Acceptance » tests based on Codeception » Functional » tests based on PHPUnit with an isolated TYPO3 instance and database access » JavaScript » tests based on JUNIT » Unit » tests based on PHPUnit to test smaller parts of your code
  11. 11. 10CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Structure Files » ext_emconf.php » mandatory file to describe your extension » ext_icon.svg, ext_icon.png or ext_icon.gif » icon used to display your extension in Extension Manager and on typo3.org » note: icons moved to Resources/Public/Icons/Extension.[svg, png, gif] with a legacy handling, but TER isn’t compatible at the moment and still uses old icon file names » ext_localconf.php » Configuration file for hook/slot registration, plugin configuration, TYPO3_CONF_VARS configuration » ext_tables.php » backend configuration e.g. for modules, hook/slot registration » ext_tables.sql » SQL definitions for your extension tables as well as changes to existing database tables
  12. 12. 11CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Configuration files
  13. 13. 12CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Configuration files TCA » table configuration for new extension tables » additional table configuration for existing tables » TYPO3CMSCoreUtilityExtensionManagementUtility::addStaticFile() » add own TypoScript files » TYPO3CMSCoreUtilityExtensionManagementUtility::makeCategorizable() » turn a field into a category field » TYPO3CMSCoreUtilityExtensionManagementUtility::registerPageTSConfigFile() » add a page TSconfig file to pages `Include Page TSConfig` field » TYPO3CMSExtbaseUtilityExtensionUtility::registerPlugin() » TYPO3CMSCoreUtilityExtensionManagementUtility::addPlugin() » add plugin to tt_content `Selected Plugin` field
  14. 14. 13CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Configuration files ext_localconf.php » earliest Boostrap entry point » contains: » TYPO3_CONF_VARS configuration » hook/slot registration » TYPO3CMSCoreUtilityExtensionManagementUtility::addPageTSConfig() » TYPO3CMSCoreUtilityExtensionManagementUtility::addUserTSConfig() » add own TSconfig configuration » TYPO3CMSCoreUtilityExtensionManagementUtility::addTypoScript() » add additional (plain) TypoScript » TYPO3CMSCoreUtilityExtensionManagementUtility::registerAjaxHandler() » add own ajax handler
  15. 15. 14CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Configuration files ext_tables.php » loaded in backend mode only » (in frontend mode only with valid backend user authentication) » contains: » TYPO3CMSCoreUtilityExtensionManagementUtility::addLLrefForTCAdescr() » load additional description reference files » TYPO3CMSCoreUtilityExtensionManagementUtility::addModule() » add an own backend module » TYPO3CMSCoreUtilityExtensionManagementUtility::allowTableOnStandardPages() » allow records on standard pages
  16. 16. 15CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Configuration files General recommendation » check TYPO3 mode » defined('TYPO3_MODE') or die('Access denied.'); » prevent global scope » (function() { // your code goes in here })();
  17. 17. 16CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Doctrine DBAL
  18. 18. 17CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Doctrine DBAL Database API » support different database system (MySQL, PostgreSQL, MSSQL) » use PHP standard packages » remove old legacy dependencies » define different database credentials (table mapping)
  19. 19. 18CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Doctrine DBAL QueryBuilder » $queryBuilder = TYPO3CMSCoreUtilityGeneralUtility::makeInstance( TYPO3CMSCoreDatabaseConnectionPool::class ) ->getQueryBuilderForTable('pages'); » $queryBuilder ->select('*') ->from('pages') ->execute(); » while ($row = $result->fetch()) { }
  20. 20. 19CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Doctrine DBAL Restrictions » applied automatically to the QueryBuilder » TYPO3CMSCoreDatabaseQueryRestrictionDeletedRestriction » TYPO3CMSCoreDatabaseQueryRestrictionHiddenRestriction » TYPO3CMSCoreDatabaseQueryRestrictionStartTimeRestriction » TYPO3CMSCoreDatabaseQueryRestrictionEndTimeRestriction » remove all restrictions and add only single ones » $queryBuilder ->getRestrictions() ->removeAll() ->add(TYPO3CMSCoreUtilityGeneralUtility::makeInstance( TYPO3CMSCoreDatabaseQueryRestrictionDeletedRestriction::class ));
  21. 21. 20CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Common pitfalls
  22. 22. 21CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Common pitfalls Dependencies » set dependencies to TYPO3 core extensions you are using » e.g. backend, core, extbase, fluid, scheduler » set version constraints only to existing versions » you don‘t know which changes will come in the future » prevent versions like 7.99.99, 8.99.99 » test the extension in the version(s) you claim to be compatible
  23. 23. 22CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Common pitfalls Fluid » variables containing objects do not belong into quotes » wrong: {f:uri.image(image: '{slide}')} » throws an error because Fluid tries to encode strings automatically » fix: {f:uri.image(image: slide)}
  24. 24. 23CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Common pitfalls Fluid » output encoding due to Fluid Standalone’s behavior change » you need to explicitly turn encoding off in the ViewHelper » two new properties of ViewHelpers to turn escaping off » protected $escapeChildren = false; » variables in the renderChildren clause are not encoded by default » necessary if the ViewHelper handles the encoding itself » protected $escapeOutput = false; » the whole ViewHelper output will not be encoded by default » necessary if the ViewHelper returns HTML
  25. 25. 24CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz General recommendations
  26. 26. 25CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz General recommendations Use PHP7 features » strict type declaration » declare (strict_types = 1); » type hinting for function parameter » return type annotation » public function getInformationForTable(string $tableName): array » null coalescing operator » $username = $_GET['user'] ?? 'nobody';
  27. 27. 26CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz General recommendations Publish on GitHub » not TYPO3 only » wide range of users » they can give feedback (add issues/requests) » they can easily fix or extend your extension (pull requests) » multiple services as integrations
  28. 28. 27CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz General recommendations Publish on Packagist » if a composer.json file is present, the registration on Packagist is mandatory » claim your vendor name for security reason » choose your vendor name wisely » otherwise you will never be able to publish the extension on Packagist » GitHub offers an integration for Packagist » you never have to do anything again
  29. 29. 28CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz General recommendations Watch your Code Style » use PSR-2 code style in your PHP code » add Style CI for automated code style tests » GitHub offers an integration » faster than running CI server with PHP-CS-Fixer » offer PHP-CS-Fixer configuration for easy command-line fixing
  30. 30. 29CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz General recommendations Test your code » You don't have tests? » There is still something to test! » run PHP linting » integrate Travis CI for automated testing » GitHub offers an integration » build is triggered for push and pull requests » try to write unit and/or functional tests for bugs
  31. 31. 30CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Additional information
  32. 32. 31CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Additional information Links » TYPO3 documentation » Extension directory structure » https://docs.typo3.org/typo3cms/CodingGuidelinesReference/FileSystemConventions/ExtensionDirec toryStructure/Index.html » TYPO3 documentation » TCA Reference » https://docs.typo3.org/typo3cms/TCAReference/Introduction/Index.html » TYPO3Wiki » Extension Developers Guide » https://wiki.typo3.org/Extension_Developers_Guide » Use TYPO3 » Good Practices in Extensions » https://usetypo3.com/good-practices-in-extensions.html
  33. 33. 32CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz Additional information Links » Jans Blog » Migrate from the TYPO3 database wrapper to the Doctrine DBAL syntax » http://jans-blog.helke.de/2016/04/14/migrate-from-the-typo3-database-wrapper-to-the-doctrine-dbal- syntax/ » doc_core_insight » TYPO3 Extension dependencies revisited » http://insight.helhum.io/post/155297666635/typo3-extension-dependencies-revisited » PHP » Migrating from PHP 5.6.x to PHP 7.0.x » http://php.net/manual/de/migration70.php
  34. 34. 33CertiFUNcation 2017, Best Practices Extension Development for TYPO3 8 LTS, Nicole Cordes, CPS-IT Mehr Wert im Netz 33 Thanks for your attention!

×