{"id":18772434,"url":"https://github.com/eftec/ampgeneratorone","last_synced_at":"2025-06-16T15:09:26.925Z","repository":{"id":56975538,"uuid":"147701070","full_name":"EFTEC/AMPGeneratorOne","owner":"EFTEC","description":"It is a library","archived":false,"fork":false,"pushed_at":"2019-09-01T01:05:32.000Z","size":8988,"stargazers_count":15,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-12T02:52:33.231Z","etag":null,"topics":["amp","amp-html","php7","seo-optimization","template"],"latest_commit_sha":null,"homepage":"https://www.eftec.cl","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EFTEC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-06T16:19:38.000Z","updated_at":"2024-09-23T21:03:44.000Z","dependencies_parsed_at":"2022-08-21T12:20:12.889Z","dependency_job_id":null,"html_url":"https://github.com/EFTEC/AMPGeneratorOne","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFTEC%2FAMPGeneratorOne","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFTEC%2FAMPGeneratorOne/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFTEC%2FAMPGeneratorOne/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EFTEC%2FAMPGeneratorOne/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EFTEC","download_url":"https://codeload.github.com/EFTEC/AMPGeneratorOne/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248683526,"owners_count":21144921,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amp","amp-html","php7","seo-optimization","template"],"created_at":"2024-11-07T19:28:58.921Z","updated_at":"2025-04-13T08:28:01.260Z","avatar_url":"https://github.com/EFTEC.png","language":"PHP","readme":"# AMPGeneratorOne\nThe library generates Google AMP sites using PHP by using procedural code.\n\n[![Build Status](https://api.travis-ci.org/EFTEC/AMPGeneratorOne.svg?branch=master)](https://travis-ci.org/EFTEC/AMPGeneratorOne)\n[![Packagist](https://img.shields.io/packagist/v/eftec/amp-generator-one.svg)](https://packagist.org/packages/eftec/amp-generator-one)\n[![Total Downloads](https://poser.pugx.org/eftec/amp-generator-one/downloads)](https://packagist.org/packages/eftec/amp-generator-one)\n[![Maintenance](https://img.shields.io/maintenance/yes/2019.svg)]()\n[![composer](https://img.shields.io/badge/composer-%3E1.8-blue.svg)]()\n[![php](https://img.shields.io/badge/php-\u003e5.6-green.svg)]()\n[![php](https://img.shields.io/badge/php-7.x-green.svg)]()\n[![CocoaPods](https://img.shields.io/badge/docs-70%25-yellow.svg)]()\n\n- [AMPGeneratorOne](#ampgeneratorone)\n  * [How it works?](#how-it-works-)\n  * [Validity](#validity)\n  * [Version](#version)\n  * [Example demo:](#example-demo-)\n\n\nThis application simplifies (via code) the generation of an AMP site.  It's easiest to program, just a few of lines of code and that's it.\n\nFor example, let's say that you want to add a new section\n```php \n$secImage= new SectionModel(\"The Cupcakes\",\"\",\"/image.jpg\");\n$secImage-\u003ebuttons[]=new ButtonModel(\"More Information\",\"#\");\n$secImage-\u003ebuttons[]=new ButtonModel(\"More Information\",\"#\",\"warning\");\n\n$amp-\u003esectionImage($secImage,2250,441);\n```\nIt will generate the next visual:\n\n![simple section](doc/simplesection.jpg)\n\n## How it works?\n\n```php \nuse eftec\\AmpGeneratorOne\\AmpGeneratorOne;\nuse eftec\\AmpGeneratorOne\\ButtonModel;\nuse eftec\\AmpGeneratorOne\\FooterModel;\nuse eftec\\AmpGeneratorOne\\HeaderModel;\nuse eftec\\AmpGeneratorOne\\HeadModel;\nuse eftec\\AmpGeneratorOne\\LinkModel;\nuse eftec\\AmpGeneratorOne\\SectionModel;\n\ninclude \"lib/AmpGeneratorOne.php\";\n$amp=new AmpGeneratorOne(\"https://www.canonical.com\",\"https://www.canonical.com/amp\");\n// # \n$amp-\u003estartAmp(new HeaderModel(\"description\",\"title\",\"favicon.ico\"));\n\n// # sidebar (optional)\n$amp-\u003esidebar($menu); // $menu is an array of /LinkModel()\n\n// #1 head (the top bar)\n$amp-\u003ehead(new HeadModel(\"\",$base.\"logo.png\"),70,70);\n\n// # example section\n$amp-\u003esectionFirst(new SectionModel(\"Title\",\"Description\"));\n\n// # footer\n$amp-\u003esectionFooter(new FooterModel(\"Copyright something(c)\",\"See as desktop\"));\n\namp-\u003erender(); // you also could generate a file.\n```\n\n![result](doc/example1.jpg)\n\nTablet version\n\n![result](doc/example1-sm.jpg)\n\nMobile version\n\n![result](doc/example1-sm(open).jpg)\n\nMobile version (slider open)\n\n## Method __construct\nAmpGeneratorOne constructor.\n\n### Parameters:  \n* **$canonical** Original url . Example https://www.southprojects.com/somesite (string)\n* **$base** Original base url without trailing slash. Example https://www.southprojects.com (string)\n* **$sidebarColor** The background color of the sidebar Example #ffffff,white,rgb(255,255,255) (string)\n* **$themecolor** .The color of the logo,burger Example #ffffff,white,rgb(255,255,255) (string)\n* **$classSidebar.** text-primary,text-secondary,text-success,text-info,text-warning,text-danger,text-white,text-black (string)\n## Method fixRelativeUrl\nFix an url and convert a relative url into an absolute url\n\n### Parameters:  \n* **$url** param $url ()\n```php\n$tmp=$ampgeneratorone-\u003efixRelativeUrlthis(); \n```\n## Method genStructured\nIt generates the social and seo structure (Twitter card, Facebook OG and Google Schema)\n\n### Parameters:  \n* **$structured** param StructureModel $structured (StructureModel)\n```php\n$tmp=$ampgeneratorone-\u003egenStructuredthis(); \n```\n## Method startAmp\nStart to generate an Amp site.\n\n### Parameters:  \n* **$param** param HeaderModel $param (HeaderModel)\n* **$structured** param StructureModel $structured (StructureModel)\n## Method sidebar\nGenerates a sidebar.\n\n### Parameters:  \n* **$urls** param LinkModel[] $urls (LinkModel[])\n```php\n$tmp=$ampgeneratorone-\u003esidebarthis(); \n```\n## Method head\nGenerates the header navigation\n\n### Parameters:  \n* **$param** param HeadModel $param (HeadModel)\n* **$width** param int $width (int)\n* **$height** param int $height (int)\n```php\n$tmp=$ampgeneratorone-\u003eheadthis(); \n```\n## Method sectionFooter\nIt generates a footer of the amp site.\n\n### Parameters:  \n* **$param** param FooterModel $param (FooterModel)\n```php\n$tmp=$ampgeneratorone-\u003esectionFooterthis(); \n```\n## Method sectionAnalytics\nGenerates a Google Analytics section\n\n### Parameters:  \n* **$account** UA-XXXXX-Y (string)\n```php\nHeaderModel());\n```\n```php\n$tmp=$ampgeneratorone-\u003esectionAnalyticsthis(); \n```\n## Method sectionFirst\nIt draw a first section (hero style)\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n```php\n$tmp=$ampgeneratorone-\u003esectionFirstthis(); \n```\n## Method sectionImageButton\nIt generates a section with a single button.\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n* **$fullscreen** param bool $fullscreen (bool)\n```php\n$tmp=$ampgeneratorone-\u003esectionImageButtonthis(); \n```\n## Method sectionText\nIt generates a section with a text.\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n```php\n$tmp=$ampgeneratorone-\u003esectionTextthis(); \n```\n## Method sectionTextQuote\nIt generates a quote text\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n```php\n$tmp=$ampgeneratorone-\u003esectionTextQuotethis(); \n```\n## Method sectionUL\nIt generates an unsorted list section\n\n### Parameters:  \n* **$links** param LinkModel[] $links (LinkModel[])\n```php\n$tmp=$ampgeneratorone-\u003esectionULthis(); \n```\n## Method sectionOL\nIt generates a sorted list section\n\n### Parameters:  \n* **$links** param LinkModel[] $links (LinkModel[])\n```php\n$tmp=$ampgeneratorone-\u003esectionOLthis(); \n```\n## Method sectionButtons\nIt generates a section with one (or more than one) buttons.\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n```php\n$tmp=$ampgeneratorone-\u003esectionButtonsthis(); \n```\n## Method sectionCols\nIt generates a section with columns\n\n### Parameters:  \n* **$contents** param SectionModel[] $contents (SectionModel[])\n```php\n$tmp=$ampgeneratorone-\u003esectionColsthis(); \n```\n## Method sectionHeaderCentral\nIt generates a header central section. It could includes buttons.\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n```php\n$tmp=$ampgeneratorone-\u003esectionHeaderCentralthis(); \n```\n## Method sectionRaw\n\n\n### Parameters:  \n## Method sectionImageContent\nIt generates a section with an image content.\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n* **$width** param $width ()\n* **$height** param $height ()\n```php\n$tmp=$ampgeneratorone-\u003esectionImageContentthis(); \n```\n## Method sectionImageContentLeft\nIt generates a section with a image content at the left.\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n* **$width** param $width ()\n* **$height** param $height ()\n```php\n$tmp=$ampgeneratorone-\u003esectionImageContentLeftthis(); \n```\n## Method sectionTable\nIt generates a table\n\n### Parameters:  \n* **$cols** param array $cols (array)\n```php\n$tmp=$ampgeneratorone-\u003esectionTablethis(); \n```\n## Method sectionImage\nIt generates an image. The size of the image is required to calculate the ratio\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n* **$width** param int $width (int)\n* **$height** param int $height (int)\n```php\n$tmp=$ampgeneratorone-\u003esectionImagethis(); \n```\n## Method sectionGMapFull\nIt generates a google map section. It can't be locate at the 30% top of the site (Amp restriction)\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n* **$googleMapUrl** param string $googleMapUrl (string)\n* **$placeholder** param string $placeholder (string)\n```php\n$tmp=$ampgeneratorone-\u003esectionGMapFullthis(); \n```\n## Method sectionGMapBoxed\nIt generates a google map (boxed) section. It can't be locate at the 30% top of the site (Amp restriction)\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n* **$googleMapUrl** param string $googleMapUrl (string)\n```php\n$tmp=$ampgeneratorone-\u003esectionGMapBoxedthis(); \n```\n## Method sectionNavigation\nIt generates a footer navigation\n\n### Parameters:  \n* **$content** param SectionModel $content (SectionModel)\n* **$image** param string $image (string)\n* **$width** param int $width (int)\n* **$height** param int $height (int)\n* **$navCol1** param LinkModel[] $navCol1 (LinkModel[])\n* **$navCol2** param LinkModel[] $navCol2 (LinkModel[])\n* **$navCol3** param LinkModel[] $navCol3 (LinkModel[])\n* **$navCol4** param LinkModel[] $navCol4 (LinkModel[])\n```php\n$tmp=$ampgeneratorone-\u003esectionNavigationthis(); \n```\n## Method sectionColImage\nIt generates a section with images and text.\n\n### Parameters:  \n* **$contents** param SectionModel[] $contents (SectionModel[])\n* **$width** param int $width (int)\n* **$height** param int $height (int)\n* **$maxCol** param int $maxCol (int)\n```php\n$tmp=$ampgeneratorone-\u003esectionColImagethis(); \n```\n## Method genModifyStyle\n\n\n### Parameters:  \n## Method setBackgroundColor\nFluent operation, it changes the background color of the next section\n\n### Parameters:  \n* **$color** Example #ffffff,rgb(30,30,30),white (string)\n```php\n$tmp=$ampgeneratorone-\u003esetBackgroundColorthis(); \n```\n## Method setBgImage\nFluent operation, it changes the background image of the next section\n\n### Parameters:  \n* **$bgImage** param string $bgImage (string)\n```php\n$tmp=$ampgeneratorone-\u003esetBgImagethis(); \n```\n## Method setClassTextColor\nFluent operation, it sets the class of the text\n\n### Parameters:  \n* **$class** text-primary,text-secondary,text-success,text-info,text-warning,text-danger,text-white,text-black (string)\n```php\n$tmp=$ampgeneratorone-\u003esetClassTextColorthis(); \n```\n## Method setPadding\nFluent operation, it changes the padding\n\n### Parameters:  \n* **$top** param $top ()\n* **$bottom** param $bottom ()\n```php\n$tmp=$ampgeneratorone-\u003esetPaddingthis(); \n```\n## Method resetDefault\n\n\n### Parameters:  \n## Method setDefault\nIt reset to the default background color and text class\n\n### Parameters:  \n* **$backGroundColor** Example #ffffff,rgb(30,30,30),white (string)\n* **$classTextColor**  text-primary,text-secondary,text-success,text-info,text-warning,text-danger,text-white,text-black (string)\n## Method image\n\n\n### Parameters:  \n## Method table\n\n\n### Parameters:  \n## Method render\nIt renders the result page.\n\n### Parameters:  \n## Method renderToFile\nIt renders the result to file\n\n### Parameters:  \n* **$filename** param string $filename (string)\n## Method genLink\nGenerate the first link of an array only if array constains information or the link is not empty.\n\n### Parameters:  \n* **$url** param LinkModel|LinkModel[] $url (LinkModel|LinkModel[])\n```php\n$tmp=$ampgeneratorone-\u003egenLinkthis(); \n```\n## Method genButton\nGenerate the first link of an array only if array constains information or the link is not empty.\n\n### Parameters:  \n* **$url** param ButtonModel|ButtonModel[] $url (ButtonModel|ButtonModel[])\n\n\n\u003e Note: You could change the color. **!**\n\n## Validity\n\nYou could validate your amp on [Google search validation](https://search.google.com/test/amp)\n\n![Google Amp Validation](doc/validate.jpg)\n\n## Version\n\n* 1.5 2019-08-31 Removed min-width in the sections.\n* 1.4 2019-06-04 Some fixes. \n* 1.3 2018-11-03 Added Phpunit and travis.\n* 1.1 2018-09-20 Fixed some bugs.\n* 1.0 2018-09-08 First non beta version\n* 0.3 2018-09-07 Cleaning the house.\n* 0.2 2018-09-06 Working version.\n* 0.1 2018-08-20 First prototype\n\n\n## Example demo:\n             \n[See end result](http://htmlpreview.github.io/?https://raw.githubusercontent.com/EFTEC/AMPGeneratorOne/master/example/example-generated.html)\n\n![Full Project](doc/fullproject.png)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feftec%2Fampgeneratorone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feftec%2Fampgeneratorone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feftec%2Fampgeneratorone/lists"}