Generating Product Descriptions & SEO Metadata with OpenAI in Laravel 13
I've been experimenting with AI features in a Laravel 13 e-commerce application, and one feature that has worked well is automatically generating product content and SEO metadata using the OpenAI API.
Instead of manually writing content for every product, a single API request generates:
Product Description
Short Product Description
SEO Meta Title
SEO Meta Description
SEO Meta Keywords
Basic configuration:
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-4.1-mini
// config/services.php
'openai' => [
'key' => env('OPENAI_API_KEY'),
],
Example request using Laravel's HTTP Client:
$response = Http::withToken(
config('services.openai.key')
)->post(
'https://api.openai.com/v1/chat/completions',
[
'model' => env('OPENAI_MODEL'),
'messages' => [
[
'role' => 'system',
'content' => 'You are an expert e-commerce SEO content writer.'
],
[
'role' => 'user',
'content' => 'Generate SEO metadata and product descriptions for iPhone 16 Pro Max.'
]
]
]
);
One optimization that noticeably reduced both latency and cost was generating all required content in a single request instead of making separate API calls for each field. Besides reducing token usage, it also keeps the generated content more consistent across the product page.
I'm interested in how other Laravel developers are approaching AI integration.
Are you using OpenAI, Anthropic, Gemini, or another provider?
Do you generate structured JSON responses or plain text?
Have you implemented caching, background queues, or other optimizations to reduce API costs?
I'd love to hear what approaches have worked well in production.
https://redd.it/1uuhwgb
@r_php
I've been experimenting with AI features in a Laravel 13 e-commerce application, and one feature that has worked well is automatically generating product content and SEO metadata using the OpenAI API.
Instead of manually writing content for every product, a single API request generates:
Product Description
Short Product Description
SEO Meta Title
SEO Meta Description
SEO Meta Keywords
Basic configuration:
OPENAI_API_KEY=your_openai_api_key
OPENAI_MODEL=gpt-4.1-mini
// config/services.php
'openai' => [
'key' => env('OPENAI_API_KEY'),
],
Example request using Laravel's HTTP Client:
$response = Http::withToken(
config('services.openai.key')
)->post(
'https://api.openai.com/v1/chat/completions',
[
'model' => env('OPENAI_MODEL'),
'messages' => [
[
'role' => 'system',
'content' => 'You are an expert e-commerce SEO content writer.'
],
[
'role' => 'user',
'content' => 'Generate SEO metadata and product descriptions for iPhone 16 Pro Max.'
]
]
]
);
One optimization that noticeably reduced both latency and cost was generating all required content in a single request instead of making separate API calls for each field. Besides reducing token usage, it also keeps the generated content more consistent across the product page.
I'm interested in how other Laravel developers are approaching AI integration.
Are you using OpenAI, Anthropic, Gemini, or another provider?
Do you generate structured JSON responses or plain text?
Have you implemented caching, background queues, or other optimizations to reduce API costs?
I'd love to hear what approaches have worked well in production.
https://redd.it/1uuhwgb
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
Generating Product Descriptions & SEO Metadata with OpenAI in Laravel 13
/r/laravel/comments/1uuhwgb/generating_product_descriptions_seo_metadata_with/
https://redd.it/1uuhx6v
@r_php
/r/laravel/comments/1uuhwgb/generating_product_descriptions_seo_metadata_with/
https://redd.it/1uuhx6v
@r_php
Reddit
From the PHP community on Reddit: Generating Product Descriptions & SEO Metadata with OpenAI in Laravel 13
Posted by stackdevelopers - 0 votes and 0 comments
Anybody else testing their sites over LAN? You should. It's cool.
Never really messed about with LAN before. I would usually just deploy to staging, wait 20 minutes, and then I could test it on my phone or give it to the PM to test.
Recently though, we added a LAN checkbox to ForgeKit (disclaimer: I built it) and holy hell, that is nice.
We’re all on the same wi-fi, so I can click one button and the PM has instant access to the site running on my machine. No need to deploy it to staging over and over for changes
I use it during development too, especially when some weird drag action doesn’t behave properly in chrome, or when I just want to see how the site actually feels on my phone instead of using devtools.
Might also be my recent obsession with self-hosting and learning how all this works that makes it more exciting than it actually is.
Anyway, mess about with LAN, folks. It’s mostly a matter of binding your local server to `0.0.0.0` instead of `127.0.0.1` and allowing it through the firewall (firewall change not even needed for me)
You can also use `sslip.io` to give each site a proper hostname. For example:
`https://myapp-test.192-168-1-10.sslip.io/`
\-> that resolves to `192.168.1.10`, and your local router or vhost can use the hostname to send it to the correct site.
It was annoyingly not working by default with Wordpress urls and with Vite, but those are easy changes to make to the site's config so it does work.
If anyone cares to know more, I'll be happy to help. Have some docs as well I can link.
So yeah, just wanted to share.
Anybody else doing this regularly? I know there's tunneling as well but I think you need account to ngrok or other tools like that that do it for you.
https://redd.it/1uuk7ty
@r_php
Never really messed about with LAN before. I would usually just deploy to staging, wait 20 minutes, and then I could test it on my phone or give it to the PM to test.
Recently though, we added a LAN checkbox to ForgeKit (disclaimer: I built it) and holy hell, that is nice.
We’re all on the same wi-fi, so I can click one button and the PM has instant access to the site running on my machine. No need to deploy it to staging over and over for changes
I use it during development too, especially when some weird drag action doesn’t behave properly in chrome, or when I just want to see how the site actually feels on my phone instead of using devtools.
Might also be my recent obsession with self-hosting and learning how all this works that makes it more exciting than it actually is.
Anyway, mess about with LAN, folks. It’s mostly a matter of binding your local server to `0.0.0.0` instead of `127.0.0.1` and allowing it through the firewall (firewall change not even needed for me)
You can also use `sslip.io` to give each site a proper hostname. For example:
`https://myapp-test.192-168-1-10.sslip.io/`
\-> that resolves to `192.168.1.10`, and your local router or vhost can use the hostname to send it to the correct site.
It was annoyingly not working by default with Wordpress urls and with Vite, but those are easy changes to make to the site's config so it does work.
If anyone cares to know more, I'll be happy to help. Have some docs as well I can link.
So yeah, just wanted to share.
Anybody else doing this regularly? I know there's tunneling as well but I think you need account to ngrok or other tools like that that do it for you.
https://redd.it/1uuk7ty
@r_php
sslip.io
Welcome to nip.io / sslip.io
Inertia-React + Filament + NativePHP boilerplate
I built a little android application at work and to make it cool and smooth i decided to use NativePHP with Inertia React, using also Filament for admin dashboard. During the implementation i realized that this tech stack isn't exactly plug-and-play so when i finished the application i decided to clean the project and make a boilerplate with this tech-stack. I also saw that over the web there are a lot of react-native or electron boilerplates, but none for nativephp. So this is the repo:
https://github.com/samuelecostantini/nativephp-react-filament-boilerplate/
https://redd.it/1uuaw3x
@r_php
I built a little android application at work and to make it cool and smooth i decided to use NativePHP with Inertia React, using also Filament for admin dashboard. During the implementation i realized that this tech stack isn't exactly plug-and-play so when i finished the application i decided to clean the project and make a boilerplate with this tech-stack. I also saw that over the web there are a lot of react-native or electron boilerplates, but none for nativephp. So this is the repo:
https://github.com/samuelecostantini/nativephp-react-filament-boilerplate/
https://redd.it/1uuaw3x
@r_php
GitHub
GitHub - samuelecostantini/nativephp-react-filament-boilerplate
Contribute to samuelecostantini/nativephp-react-filament-boilerplate development by creating an account on GitHub.
TypeLang 2.0
Two years ago, I posted about the initial release of the PHP types parser: [https://www.reddit.com/r/PHP/comments/1c4w64n/php\_typelang\_100\_release/](https://www.reddit.com/r/PHP/comments/1c4w64n/php_typelang_100_release/)
Back then, it was TypeLang 1.0.0.
Since then, I've released numerous smaller updates, adding [new PHPStan grammar features](https://github.com/phpstan/phpdoc-parser/releases/tag/2.3.0) and fixing various bugs.
Today, I'd like to share the release of TypeLang 2.0 Beta with the community.
Why major 2.0 release?
**An AST has been completely redesigned**
I completely reorganized the AST, removing ambiguous nodes and improving the overall structure. It's now available as a separate package: [type-lang/types](https://packagist.org/packages/type-lang/types).
This allows the remaining components to work independently of the parser itself. For example, you can use the [PHPStan parser](https://packagist.org/packages/phpstan/phpdoc-parser) and implement a bridge that returns TypeLang type descriptions without depending on the parser implementation.
**The Language Specification**
Here: [https://typelang.dev/static/spec.html](https://typelang.dev/static/spec.html)
I consider this one of the biggest milestones of the project. I've spent the last \~2 months writing a complete language specification from scratch.
It's still marked as a "*draft"*, but I believe it's already mature enough for public use. The specification is compatible with both PEG and LALR parsers.
While writing it, I was heavily inspired by the GraphQL specification, so if it gives you a sense of "*deja vu"*, that's intentional =)
**DocBlock Parser**
The DocBlock (PhpDoc) parser used to be somewhat experimental. In 2.0, it's fully integrated into the ecosystem and now supports parsing more than 220+ PHP DocBlock tags.
To achieve this, I analyzed the source code of PHPStan, Psalm, and Phan, along with the documentation of many other popular PHP tools, to build a complete list of supported tags.
Each tag also has its own documentation page explaining its purpose and which tools support it. For example: [https://typelang.dev/phpstan-tags.html](https://typelang.dev/phpstan-tags.html)
The tag database was built using the following process:
* Extract the tag from the source code
* Find the corresponding official documentation (including PSR-19)
* Write a short description manually, then use AI to review the text for mistakes and generate usage examples.
It's entirely possible that I've missed something or made a few mistakes, but overall I believe the documentation is in good shape.
I also added support for custom tags using the PEG (parser combinator) grammar: [https://typelang.dev/custom-tags.html](https://typelang.dev/custom-tags.html)
I won't go into detail here, otherwise this post would turn into documentation instead of release post =)
**What's Next?**
I've also been experimenting with a *Data Mapper* that uses TypeLang's type syntax: [https://typelang.dev/data-mapper.html](https://typelang.dev/data-mapper.html)
In some ways it's similar to [Valinor](https://valinor-php.dev/latest/). However, it probably won't make it into the final 2.0 release.
Apart from the data mapper, all documentation has already been updated for the Beta 2.0 release (although JetBrains Writerside unfortunately doesn't handle versioning particularly well).
I'd really appreciate any feedback, comments, or criticism - whether it's about the implementation or the documentation.
I'm especially interested in hearing from anyone who tried TypeLang 1.x or is already using it in production and is considering upgrading.
P.S. It's worth noting that I've made every effort to proofread the documentation. However, English isn't my native language, so I may have made some grammatical errors or written in a way that's not entirely understandable to a native speaker. If you encounter any such errors, please feel free to report them.
Thx!
https://redd.it/1uuqxny
@r_php
Two years ago, I posted about the initial release of the PHP types parser: [https://www.reddit.com/r/PHP/comments/1c4w64n/php\_typelang\_100\_release/](https://www.reddit.com/r/PHP/comments/1c4w64n/php_typelang_100_release/)
Back then, it was TypeLang 1.0.0.
Since then, I've released numerous smaller updates, adding [new PHPStan grammar features](https://github.com/phpstan/phpdoc-parser/releases/tag/2.3.0) and fixing various bugs.
Today, I'd like to share the release of TypeLang 2.0 Beta with the community.
Why major 2.0 release?
**An AST has been completely redesigned**
I completely reorganized the AST, removing ambiguous nodes and improving the overall structure. It's now available as a separate package: [type-lang/types](https://packagist.org/packages/type-lang/types).
This allows the remaining components to work independently of the parser itself. For example, you can use the [PHPStan parser](https://packagist.org/packages/phpstan/phpdoc-parser) and implement a bridge that returns TypeLang type descriptions without depending on the parser implementation.
**The Language Specification**
Here: [https://typelang.dev/static/spec.html](https://typelang.dev/static/spec.html)
I consider this one of the biggest milestones of the project. I've spent the last \~2 months writing a complete language specification from scratch.
It's still marked as a "*draft"*, but I believe it's already mature enough for public use. The specification is compatible with both PEG and LALR parsers.
While writing it, I was heavily inspired by the GraphQL specification, so if it gives you a sense of "*deja vu"*, that's intentional =)
**DocBlock Parser**
The DocBlock (PhpDoc) parser used to be somewhat experimental. In 2.0, it's fully integrated into the ecosystem and now supports parsing more than 220+ PHP DocBlock tags.
To achieve this, I analyzed the source code of PHPStan, Psalm, and Phan, along with the documentation of many other popular PHP tools, to build a complete list of supported tags.
Each tag also has its own documentation page explaining its purpose and which tools support it. For example: [https://typelang.dev/phpstan-tags.html](https://typelang.dev/phpstan-tags.html)
The tag database was built using the following process:
* Extract the tag from the source code
* Find the corresponding official documentation (including PSR-19)
* Write a short description manually, then use AI to review the text for mistakes and generate usage examples.
It's entirely possible that I've missed something or made a few mistakes, but overall I believe the documentation is in good shape.
I also added support for custom tags using the PEG (parser combinator) grammar: [https://typelang.dev/custom-tags.html](https://typelang.dev/custom-tags.html)
I won't go into detail here, otherwise this post would turn into documentation instead of release post =)
**What's Next?**
I've also been experimenting with a *Data Mapper* that uses TypeLang's type syntax: [https://typelang.dev/data-mapper.html](https://typelang.dev/data-mapper.html)
In some ways it's similar to [Valinor](https://valinor-php.dev/latest/). However, it probably won't make it into the final 2.0 release.
Apart from the data mapper, all documentation has already been updated for the Beta 2.0 release (although JetBrains Writerside unfortunately doesn't handle versioning particularly well).
I'd really appreciate any feedback, comments, or criticism - whether it's about the implementation or the documentation.
I'm especially interested in hearing from anyone who tried TypeLang 1.x or is already using it in production and is considering upgrading.
P.S. It's worth noting that I've made every effort to proofread the documentation. However, English isn't my native language, so I may have made some grammatical errors or written in a way that's not entirely understandable to a native speaker. If you encounter any such errors, please feel free to report them.
Thx!
https://redd.it/1uuqxny
@r_php
Reddit
From the PHP community on Reddit: PHP TypeLang 1.0.0 Release
Explore this post and more from the PHP community
What if common PHP traits were implemented as native C extensions instead of PHP?
https://github.com/arshidkv12/traitify
https://redd.it/1uuzltg
@r_php
https://github.com/arshidkv12/traitify
https://redd.it/1uuzltg
@r_php
GitHub
GitHub - arshidkv12/traitify: It is a native PHP extension that provides commonly used traits
It is a native PHP extension that provides commonly used traits - arshidkv12/traitify
What's the easiest way to serialize a PHP oparray in C?
I'm working on a PHP extension and need to serialize a zend\op_array in C so I can store it and restore it later.
I know OPcache already serializes op arrays, but its implementation is quite complex. I'm looking for a much simpler approach, even if it doesn't support every OPcache optimization or edge case.
Is there an existing API, library, or recommended way to do this, or is manually serializing each field the only practical option?
Any suggestions or examples would be greatly appreciated.
https://redd.it/1uv8lzw
@r_php
I'm working on a PHP extension and need to serialize a zend\op_array in C so I can store it and restore it later.
I know OPcache already serializes op arrays, but its implementation is quite complex. I'm looking for a much simpler approach, even if it doesn't support every OPcache optimization or edge case.
Is there an existing API, library, or recommended way to do this, or is manually serializing each field the only practical option?
Any suggestions or examples would be greatly appreciated.
https://redd.it/1uv8lzw
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
Can laravel replace Supabase out of the box for mobile backend?
I have a background in web development especially in PHP and I'm very familiar with laravel but haven't worked with it for years and I never used it for pure mobile APIs (user, auth, social media etc) but mainly for web sites.
Now I'm planning to build a mobile app (Flutter or RN) and I read good things about Supabase where you have a database and all the tools needed to handle basically everything basic that's very easily integrated with those mobile flatform.
However when it comes to custom logic that needs to happen I'm not sure I'll be familiar to learn typescript and the workflow of edge functions.
Do you think Laravel provides a "templates" where you already all the tools Supabase provides or you have to build your basic API from scratch?
https://redd.it/1uvb54w
@r_php
I have a background in web development especially in PHP and I'm very familiar with laravel but haven't worked with it for years and I never used it for pure mobile APIs (user, auth, social media etc) but mainly for web sites.
Now I'm planning to build a mobile app (Flutter or RN) and I read good things about Supabase where you have a database and all the tools needed to handle basically everything basic that's very easily integrated with those mobile flatform.
However when it comes to custom logic that needs to happen I'm not sure I'll be familiar to learn typescript and the workflow of edge functions.
Do you think Laravel provides a "templates" where you already all the tools Supabase provides or you have to build your basic API from scratch?
https://redd.it/1uvb54w
@r_php
Reddit
From the PHP community on Reddit
Explore this post and more from the PHP community
laracasts - cant download videos anymore?
as per the title - went to download videos and they have disabled it - cant see download video anymore.
https://redd.it/1uveo6h
@r_php
as per the title - went to download videos and they have disabled it - cant see download video anymore.
https://redd.it/1uveo6h
@r_php
Reddit
From the laravel community on Reddit
Explore this post and more from the laravel community
SuperNative Makes Native Mobile Apps Easier to Build Than a WordPress Site
https://nativephp.com/blog/supernative
https://redd.it/1uvenhm
@r_php
https://nativephp.com/blog/supernative
https://redd.it/1uvenhm
@r_php
Nativephp
SuperNative: Build Truly Native Mobile Apps With Laravel. No WebView
Because calling it just "native" wasn't enough
Cassandra/ScyllaDB PHP Driver new release
Hello folks, I've released new long awaited version (v1.4.0) of Cassandra/ScyllaDB driver with lot's of fixes and performance improvements.
https://github.com/he4rt/scylladb-php-driver
If someone is using the driver, please test it and report issues, or some feature requests. I'm now fully back on maintaining it regularly and improving it for the foreseeable future. Also wrote a blog post on my website explaining the changes done to the driver
https://www.dusanmalusev.dev/blog/scylladb-php-driver-140-the-extension-is-pure-c23-now
https://redd.it/1uvnp9l
@r_php
Hello folks, I've released new long awaited version (v1.4.0) of Cassandra/ScyllaDB driver with lot's of fixes and performance improvements.
https://github.com/he4rt/scylladb-php-driver
If someone is using the driver, please test it and report issues, or some feature requests. I'm now fully back on maintaining it regularly and improving it for the foreseeable future. Also wrote a blog post on my website explaining the changes done to the driver
https://www.dusanmalusev.dev/blog/scylladb-php-driver-140-the-extension-is-pure-c23-now
https://redd.it/1uvnp9l
@r_php
GitHub
GitHub - he4rt/scylladb-php-driver: PHP Driver for ScyllaDB/Apache Cassandra
PHP Driver for ScyllaDB/Apache Cassandra. Contribute to he4rt/scylladb-php-driver development by creating an account on GitHub.
SuperNative Makes Native Mobile Apps Easier to Build Than a WordPress Site
https://nativephp.com/blog/supernative
https://redd.it/1uvdaxa
@r_php
https://nativephp.com/blog/supernative
https://redd.it/1uvdaxa
@r_php
Nativephp
SuperNative: Build Truly Native Mobile Apps With Laravel. No WebView
Because calling it just "native" wasn't enough
🚀 Zero-downtime Laravel migrations made simple.
Learn the Expand → Migrate → Contract pattern to deploy database schema changes safely without downtime.
https://richdynamix.com/articles/laravel-zero-downtime-migrations-expand-contract
https://redd.it/1uw3ryl
@r_php
Learn the Expand → Migrate → Contract pattern to deploy database schema changes safely without downtime.
https://richdynamix.com/articles/laravel-zero-downtime-migrations-expand-contract
https://redd.it/1uw3ryl
@r_php
RichDynamix
Laravel Zero-Downtime Migrations: Expand and Contract Pattern | RichDynamix
A step-by-step guide to Laravel zero-downtime migrations with the expand and contract pattern: nullable expands, batched backfills, and flagged reads.
Scramble 0.13.34 – Laravel API documentation generator update: caching, Scalar support, plain PHP objects documentation and more
https://scramble.dedoc.co/blog/scrambledrop-scramble-01334
https://redd.it/1uw6bxw
@r_php
https://scramble.dedoc.co/blog/scrambledrop-scramble-01334
https://redd.it/1uw6bxw
@r_php
scramble.dedoc.co
#scrambledrop: Scramble 0.13.34 - Scramble
OpenAPI (Swagger) documentation generator for Laravel. Without manual PHPDoc annotations.
Built a centralised auth platform. Need help finishing up
Hi Everyone,
I've been working on a centralised authentication platform in PHP, which will be able to integrate with third party apps. It's almost finished with the functionality. But I need some help identifying the potential bugs and issues and possible improvements. Please check the project and help me with that.
https://codeberg.org/bhaswanth/helios
Thank you
https://redd.it/1uw8b0i
@r_php
Hi Everyone,
I've been working on a centralised authentication platform in PHP, which will be able to integrate with third party apps. It's almost finished with the functionality. But I need some help identifying the potential bugs and issues and possible improvements. Please check the project and help me with that.
https://codeberg.org/bhaswanth/helios
Thank you
https://redd.it/1uw8b0i
@r_php
Codeberg.org
helios
Centralized Authentication for Modern Applications