Hello,
A content appears in the TOC if it has an outlineLvl tag and its value is in the range of the allowed values by the TOC. Maybe your paragraph styles Heading1 and Heading1Line don't include that tag (a name such as Heading doesn't create automatically an outlineLvl tag); internally, in OOXML, a heading style is a style with an outlineLvl tag. Phpdocx includes heading styles you can use:
https://www.phpdocx.com/api-documentation/word-content/insert-heading-Word-document-with-PHP
an options to set heading levels dynamically (headingLevel):
https://www.phpdocx.com/api-documentation/word-content/add-paragraph-text-Word-document-with-PHP
This is explained on https://www.phpdocx.com/documentation/cookbook/tables-of-contents (Adding items to the TOC section). We recommend you to read the documentation available on this page step by step and the example Core/addTableContents to understand how to use a TOC.
You can add contents to the TOC using a template or creating the document from scratch.
Regards.