@@ -176,6 +176,54 @@ $response = $client->request(
176176);
177177```
178178
179+ ## Examples
180+
181+ The ` examples/ ` directory contains comprehensive examples demonstrating various use cases:
182+
183+ ### Basic Examples
184+ - ** [ SmartScraper] ( examples/basic/basic-smartscraper.php ) ** - Extract data from web pages using natural language prompts
185+ - ** [ Markdownify] ( examples/basic/basic-markdownify.php ) ** - Convert web pages to clean Markdown format
186+ - ** [ SearchScraper] ( examples/basic/basic-searchscraper.php ) ** - Search and scrape data from multiple websites
187+ - ** [ Crawl] ( examples/basic/basic-crawl.php ) ** - Systematically crawl entire websites
188+ - ** [ Generate Schema] ( examples/basic/basic-schema.php ) ** - Generate JSON schemas from natural language
189+ - ** [ Credits] ( examples/basic/basic-credits.php ) ** - Check your API credit balance
190+ - ** [ Validate] ( examples/basic/basic-validate.php ) ** - Validate your API key
191+
192+ ### Advanced Examples
193+ - ** [ Advanced SmartScraper] ( examples/advanced/advanced-smartscraper.php ) ** - Complex schemas, JavaScript rendering, pagination
194+ - ** [ Error Handling] ( examples/advanced/advanced-error-handling.php ) ** - Comprehensive error handling strategies
195+
196+ ### Real-World Use Cases
197+ - ** [ E-commerce Scraper] ( examples/use-cases/ecommerce-scraper.php ) ** - Product monitoring, price comparison, review analysis
198+ - ** [ News Aggregator] ( examples/use-cases/news-aggregator.php ) ** - Multi-source news monitoring, sentiment analysis
199+ - ** [ Job Listings] ( examples/use-cases/job-listings.php ) ** - Job search aggregation, salary benchmarking, skills analysis
200+
201+ ### Quick Start Example
202+
203+ ``` php
204+ <?php
205+ require_once 'vendor/autoload.php';
206+
207+ use Scrapegraphai\Client;
208+ use Scrapegraphai\Smartscraper\SmartscraperCreateParams;
209+
210+ // Initialize client
211+ $client = new Client(
212+ apiKey: getenv('SCRAPEGRAPHAI_API_KEY')
213+ );
214+
215+ // Extract product information
216+ $params = SmartscraperCreateParams::from(
217+ userPrompt: "Extract the product name, price, and rating",
218+ websiteURL: "https://example-store.com/product"
219+ );
220+
221+ $result = $client->smartscraper->create($params);
222+ echo json_encode($result->data, JSON_PRETTY_PRINT);
223+ ```
224+
225+ For more examples and detailed documentation, see the [ examples directory] ( examples/ ) .
226+
179227## Versioning
180228
181229This package follows [ SemVer] ( https://semver.org/spec/v2.0.0.html ) conventions. As the library is in initial development and has a major version of ` 0 ` , APIs may change at any time.
0 commit comments