repo stringlengths 7 63 | file_url stringlengths 81 284 | file_path stringlengths 5 200 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:02:33 2026-01-05 05:24:06 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/HomeController.php | app/Http/Controllers/HomeController.php | <?php
namespace App\Http\Controllers;
use Illuminate\View\View;
class HomeController extends Controller
{
/**
* Show the home page.
*
* @return \Illuminate\View\View
*/
public function __invoke(): View
{
return view('home');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/SearchEmailController.php | app/Http/Controllers/SearchEmailController.php | <?php
namespace App\Http\Controllers;
use App\Search;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
class SearchEmailController extends Controller
{
/**
* Send a file with all the search's emails.
*
* @param \App\Search $search
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function __invoke(Search $search): BinaryFileResponse
{
$emails = $search->emails->pluck('name')->unique()->all();
$tempFileName = str_random() . '.txt';
Storage::put($tempFileName, implode("\r\n", $emails));
return response()
->download(storage_path("app/{$tempFileName}"))
->deleteFileAfterSend(true);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/DashboardController.php | app/Http/Controllers/DashboardController.php | <?php
namespace App\Http\Controllers;
use Illuminate\View\View;
class DashboardController extends Controller
{
/**
* Show the dashboard page.
*
* @return \Illuminate\View\View
*/
public function __invoke(): View
{
return view('dashboard');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Auth/LoginController.php | app/Http/Controllers/Auth/LoginController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
$this->redirectTo = route('dashboard');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Auth/ForgotPasswordController.php | app/Http/Controllers/Auth/ForgotPasswordController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Auth/ResetPasswordController.php | app/Http/Controllers/Auth/ResetPasswordController.php | <?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/**
* Where to redirect users after resetting their password.
*
* @var string
*/
protected $redirectTo;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
$this->redirectTo = route('dashboard');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Auth/RegisterController.php | app/Http/Controllers/Auth/RegisterController.php | <?php
namespace App\Http\Controllers\Auth;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
$this->redirectTo = route('dashboard');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Api/UserController.php | app/Http/Controllers/Api/UserController.php | <?php
namespace App\Http\Controllers\Api;
use App\Http\Requests\UserRequest;
use App\Http\Resources\UserResource;
use App\User;
use Illuminate\Http\Request;
class UserController extends ApiController
{
/**
* Show the specified resource.
*
* @param \Illuminate\Http\Request $request
* @return \App\Http\Resources\UserResource
*/
public function me(Request $request): UserResource
{
return new UserResource($request->user());
}
/**
* Update the specified resource in storage.
*
* @param \App\Http\Requests\UserRequest $request
* @param \App\User $user
* @return \App\Http\Resources\UserResource
*/
public function update(UserRequest $request, User $user): UserResource
{
$user->update($request->validated());
return new UserResource($user->fresh());
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Api/SearchController.php | app/Http/Controllers/Api/SearchController.php | <?php
namespace App\Http\Controllers\Api;
use App\Http\Requests\SearchRequest;
use App\Http\Resources\SearchResource;
use App\Search;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;
class SearchController extends ApiController
{
/**
* Display the specified resource.
*
* @param \App\Search $search
* @return \App\Http\Resources\SearchResource
*/
public function show(Search $search): SearchResource
{
return new SearchResource($search);
}
/**
* Update the specified resource in storage.
*
* @param \App\Http\Requests\SearchRequest $request
* @param \App\Search $search
* @return \App\Http\Resources\SearchResource
*/
public function update(SearchRequest $request, Search $search): SearchResource
{
$search->update(array_filter($request->validated()));
return new SearchResource($search->fresh());
}
/**
* Remove the specified resource from storage.
*
* @param \App\Search $search
* @return \Illuminate\Http\JsonResponse
*/
public function destroy(Search $search): JsonResponse
{
$search->delete();
return new JsonResponse(null, Response::HTTP_NO_CONTENT);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Api/SearchStatisticsController.php | app/Http/Controllers/Api/SearchStatisticsController.php | <?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Resources\SearchResource;
use App\Search;
use Illuminate\Database\Eloquent\Builder;
class SearchStatisticsController extends Controller
{
/**
* Show the specified resource.
*
* @param \App\Search $search
* @return \App\Http\Resources\SearchResource
*/
public function show(Search $search): SearchResource
{
$search = Search::withCount([
'emails',
'urls',
'urls as crawled_urls_count' => function (Builder $query) {
$query->where('is_crawled', true);
},
'urls as not_crawled_urls_count' => function (Builder $query) {
$query->where('is_crawled', false);
}
])->find($search->id);
return new SearchResource($search);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Api/UserSearchController.php | app/Http/Controllers/Api/UserSearchController.php | <?php
namespace App\Http\Controllers\Api;
use App\Http\Requests\UserSearchRequest;
use App\Http\Resources\SearchCollection;
use App\Http\Resources\SearchResource;
use App\Jobs\CrawlJob;
use App\User;
class UserSearchController extends ApiController
{
/**
* Display a listing of the resource.
*
* @param \App\User $user
* @return \App\Http\Resources\SearchCollection
*/
public function index(User $user): SearchCollection
{
return new SearchCollection($user->searches()->paginate());
}
/**
* Store a newly created resource in storage.
*
* @param \App\Http\Requests\UserSearchRequest $request
* @param \App\User $user
* @return \App\Http\Resources\SearchResource
*/
public function store(UserSearchRequest $request, User $user): SearchResource
{
$search = $user->searches()->create($request->validated());
CrawlJob::dispatch($search);
return new SearchResource($search->fresh());
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Controllers/Api/ApiController.php | app/Http/Controllers/Api/ApiController.php | <?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
class ApiController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\JsonResponse
*/
public function apiIndex(): JsonResponse
{
return new JsonResponse(['version' => 'v1']);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Middleware/RedirectIfAuthenticated.php | app/Http/Middleware/RedirectIfAuthenticated.php | <?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect(route('dashboard'));
}
return $next($request);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Middleware/TrustProxies.php | app/Http/Middleware/TrustProxies.php | <?php
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Fideloper\Proxy\TrustProxies as Middleware;
class TrustProxies extends Middleware
{
/**
* The trusted proxies for this application.
*
* @var array
*/
protected $proxies;
/**
* The headers that should be used to detect proxies.
*
* @var string
*/
protected $headers = Request::HEADER_X_FORWARDED_ALL;
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Middleware/TrimStrings.php | app/Http/Middleware/TrimStrings.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
class TrimStrings extends Middleware
{
/**
* The names of the attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
'password',
'password_confirmation',
];
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Middleware/EncryptCookies.php | app/Http/Middleware/EncryptCookies.php | <?php
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
class EncryptCookies extends Middleware
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
//
];
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Middleware/VerifyCsrfToken.php | app/Http/Middleware/VerifyCsrfToken.php | <?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
];
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Resources/UserResource.php | app/Http/Resources/UserResource.php | <?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
class UserResource extends Resource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return parent::toArray($request);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Resources/SearchCollection.php | app/Http/Resources/SearchCollection.php | <?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\ResourceCollection;
class SearchCollection extends ResourceCollection
{
/**
* Transform the resource collection into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return parent::toArray($request);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Http/Resources/SearchResource.php | app/Http/Resources/SearchResource.php | <?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
class SearchResource extends Resource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return parent::toArray($request);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Services/Crawler/Crawler.php | app/Services/Crawler/Crawler.php | <?php
namespace App\Services\Crawler;
use App\Email;
use App\Search;
use App\Url;
use Hedii\Extractors\Extractor;
class Crawler
{
/**
* The search instance.
*
* @var \App\Search
*/
private $search;
/**
* The extractor instance.
*
* @var \Hedii\Extractors\Extractor
*/
private $extractor;
/**
* Crawler constructor.
*
* @param \App\Search $search
*/
public function __construct(Search $search)
{
$this->search = $search;
$this->extractor = new Extractor();
}
/**
* Run the crawler until the search is finished or until
* the search is deleted.
*
* @return bool
*/
public function run(): bool
{
$this->search->update(['status' => Search::STATUS_RUNNING]);
// we first need to crawl the search's entry point url
$this->crawl($this->search->url, $entryPoint = true);
// next, we crawl all search's urls
while ($url = $this->getNextNotCrawledUrl()) {
$this->crawl($url);
// check if the search has been deleted during the crawl process
//if ($this->searchMustEnd()) {
// return false;
//}
}
// this search is finished
$this->search->update(['status' => Search::STATUS_FINISHED]);
return false;
}
/**
* Crawl an url and extract resources.
*
* @param mixed $url
* @param bool $entryPoint
*/
private function crawl($url, bool $entryPoint = false): void
{
$results = $this->extractor
->searchFor(['urls', 'emails'])
->at($entryPoint ? $url : $url->name)
->get();
foreach (array_unique($results['urls']) as $item) {
$item = $this->cleanUrl($item);
if ($this->canBeStored($item) && $this->isValidUrl($item) && $this->isNotMediaFile($item) && $this->isInScope($item)) {
Url::firstOrCreate(['name' => $item, 'search_id' => $this->search->id]);
}
}
foreach (array_unique($results['emails']) as $email) {
if ($this->canBeStored($email) && $this->isValidEmail($email)) {
Email::firstOrCreate(['name' => $email, 'search_id' => $this->search->id]);
}
}
if (! $entryPoint) {
$url->update(['is_crawled' => true]);
}
}
/**
* Check if the search has been deleted or marked as finished.
*
* @return bool
*/
private function searchMustEnd(): bool
{
return in_array($this->search->fresh()->status, [
Search::STATUS_FINISHED,
Search::STATUS_FAILED,
Search::STATUS_PAUSED
]);
}
/**
* Get the search's url that has not been crawled yet.
*
* @return \App\Url|null
*/
private function getNextNotCrawledUrl(): ?Url
{
return $this->search->urls()
->notCrawled()
->first();
}
/**
* A wrapper for php parse_url host function.
*
* @param string $url
* @return string|null
*/
private function getDomainName(string $url): ?string
{
return parse_url($url, PHP_URL_HOST) ?: null;
}
/**
* A wrapper for php filter_var url function.
*
* @param string $url
* @return bool
*/
private function isValidUrl(string $url): bool
{
return filter_var($url, FILTER_VALIDATE_URL) !== false;
}
/**
* A wrapper for php filter_var email function.
*
* @param string $email
* @return bool
*/
private function isValidEmail(string $email): bool
{
return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;
}
/**
* Remove unwanted character at the end of the url string,
* and remove anchors in the url.
*
* @param string $url
* @return string
*/
private function cleanUrl(string $url): string
{
$url = rtrim(rtrim($url, '#'), '/');
$fragment = parse_url($url, PHP_URL_FRAGMENT);
if (! empty($fragment)) {
$url = str_replace("#{$fragment}", '', $url);
}
return rtrim($url, '?');
}
/**
* Whether a given url is a media file url.
*
* @param string $url
* @return bool
*/
private function isMediaFile(string $url): bool
{
return ends_with($url, [
'.jpg', '.jp2', '.jpeg', '.raw', '.png', '.gif', '.tiff', '.bmp',
'.svg', '.fla', '.swf', '.css', '.js', '.mp3', '.aac', '.wav',
'.wma', '.aac', '.mp4', '.ogg', '.oga', '.ogv', '.flac', '.fla',
'.ape', '.mpc', '.aif', '.aiff', '.m4a', '.mov', '.avi', '.wmv',
'.qt', '.mp4a', '.mp4v', '.flv', '.ogm', '.mkv', '.mka', '.mks'
]);
}
/**
* Whether a given url is a not media file url.
*
* @param string $url
* @return bool
*/
private function isNotMediaFile(string $url): bool
{
return ! $this->isMediaFile($url);
}
/**
* Whether the given url in the scope of the current search.
*
* @param string $url
* @return bool
*/
private function isInScope(string $url): bool
{
if (! $this->search->is_limited) {
return true;
}
return $this->getDomainName($url) === $this->getDomainName($this->search->url);
}
/**
* Whether a value can be stored in a mysql varchar field.
*
* @param string $value
* @return bool
*/
private function canBeStored(string $value): bool
{
return strlen($value) <= 255;
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Console/Kernel.php | app/Console/Kernel.php | <?php
namespace App\Console;
use App\Console\Commands\CrawlCommand;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
CrawlCommand::class
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Console/Commands/BuildCommand.php | app/Console/Commands/BuildCommand.php | <?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class BuildCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'crawler:build';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Build the crawler app';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(): bool
{
$this->comment('Running fresh application migrations');
$returnCode = $this->call('migrate:fresh');
if ($returnCode !== 0) {
$this->error('Unable run the fresh application migrations');
return false;
} else {
$this->info('Application fresh migrations ok');
$this->line('---');
}
$this->comment('Installing Laravel Passport');
$returnCode = $this->callSilent('passport:install');
if ($returnCode !== 0) {
$this->error('Unable to install Laravel Passport');
return false;
} else {
$this->info('Laravel Passport installed');
$this->line('---');
}
$this->info('Crawler app ready!');
return true;
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Console/Commands/CrawlCommand.php | app/Console/Commands/CrawlCommand.php | <?php
namespace App\Console\Commands;
use App\Search;
use App\Services\Crawler\Crawler;
use Illuminate\Console\Command;
class CrawlCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'crawler:crawl {search_id : A search id}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Start a new crawler on a given search';
/**
* Execute the console command.
*
* @return bool
*/
public function handle(): bool
{
if (! $search = Search::find($this->argument('search_id'))) {
$this->error("No search with the id `{$this->argument('search_id')}`");
return false;
}
$crawler = new Crawler($search);
return $crawler->run();
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Providers/BroadcastServiceProvider.php | app/Providers/BroadcastServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Broadcast;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Providers/RouteServiceProvider.php | app/Providers/RouteServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* This namespace is applied to your controller routes.
*
* In addition, it is set as the URL generator's root namespace.
*
* @var string
*/
protected $namespace = 'App\Http\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
* @return void
*/
public function boot()
{
//
parent::boot();
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->mapApiRoutes();
$this->mapWebRoutes();
//
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*
* @return void
*/
protected function mapApiRoutes()
{
Route::prefix('api')
->prefix('api/v1')
->middleware('api')
->namespace("{$this->namespace}\Api")
->group(base_path('routes/api.php'));
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Providers/EventServiceProvider.php | app/Providers/EventServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\Facades\Event;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
class EventServiceProvider extends ServiceProvider
{
/**
* The event listener mappings for the application.
*
* @var array
*/
protected $listen = [
'App\Events\Event' => [
'App\Listeners\EventListener',
],
];
/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
parent::boot();
//
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Providers/AppServiceProvider.php | app/Providers/AppServiceProvider.php | <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Providers/AuthServiceProvider.php | app/Providers/AuthServiceProvider.php | <?php
namespace App\Providers;
use App\Policies\SearchPolicy;
use App\Policies\UserPolicy;
use App\Search;
use App\User;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Laravel\Passport\Passport;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
*/
protected $policies = [
User::class => UserPolicy::class,
Search::class => SearchPolicy::class
];
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->registerPolicies();
Passport::routes();
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Policies/UserPolicy.php | app/Policies/UserPolicy.php | <?php
namespace App\Policies;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view the model.
*
* @param \App\User $user
* @param \App\User $model
* @return bool
*/
public function view(User $user, User $model): bool
{
return $user->id === $model->id;
}
/**
* Determine whether the user can update the model.
*
* @param \App\User $user
* @param \App\User $model
* @return bool
*/
public function update(User $user, User $model): bool
{
return $user->id === $model->id;
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/app/Policies/SearchPolicy.php | app/Policies/SearchPolicy.php | <?php
namespace App\Policies;
use App\User;
use App\Search;
use Illuminate\Auth\Access\HandlesAuthorization;
class SearchPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view the search.
*
* @param \App\User $user
* @param \App\Search $search
* @return bool
*/
public function view(User $user, Search $search): bool
{
return $user->id === $search->user_id;
}
/**
* Determine whether the user can create searches.
*
* @param \App\User $user
* @return bool
*/
public function create(User $user): bool
{
return true;
}
/**
* Determine whether the user can update the search.
*
* @param \App\User $user
* @param \App\Search $search
* @return bool
*/
public function update(User $user, Search $search): bool
{
return $user->id === $search->user_id;
}
/**
* Determine whether the user can delete the search.
*
* @param \App\User $user
* @param \App\Search $search
* @return bool
*/
public function delete(User $user, Search $search): bool
{
return $user->id === $search->user_id;
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/bootstrap/app.php | bootstrap/app.php | <?php
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(
Illuminate\Contracts\Http\Kernel::class,
App\Http\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
| This script returns the application instance. The instance is given to
| the calling script so we can separate the building of the instances
| from the actual running of the application and sending responses.
|
*/
return $app;
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/TestCase.php | tests/TestCase.php | <?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/CreatesApplication.php | tests/CreatesApplication.php | <?php
namespace Tests;
use Illuminate\Contracts\Console\Kernel;
trait CreatesApplication
{
/**
* Creates the application.
*
* @return \Illuminate\Foundation\Application
*/
public function createApplication()
{
$app = require __DIR__.'/../bootstrap/app.php';
$app->make(Kernel::class)->bootstrap();
return $app;
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/UserEmailTest.php | tests/Feature/UserEmailTest.php | <?php
namespace Tests\Feature;
use App\Email;
use App\Search;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class UserEmailTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_to_download_user_emails()
{
$user = factory(User::class)->create();
$this
->get(route('user.emails', $user))
->assertStatus(Response::HTTP_FOUND)
->assertRedirect(route('login'));
}
/** @test */
public function a_user_cannot_download_another_user_emails()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$this
->actingAs($user2)
->get(route('user.emails', $user1))
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function a_user_can_download_all_of_his_emails()
{
$user = factory(User::class)->create()->fresh();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$email0 = factory(Email::class)->create(['search_id' => $search->id]);
$email1 = factory(Email::class)->create(['search_id' => $search->id]);
$email2 = factory(Email::class)->create(['search_id' => $search->id]);
$response = $this
->actingAs($user)
->get(route('user.emails', $user));
$response->assertStatus(Response::HTTP_OK);
/** @var \Symfony\Component\HttpFoundation\File\File $file */
$file = $response->getFile();
$this->assertSame('txt', $file->guessExtension());
foreach ($file->openFile() as $lineNumber => $content) {
$this->assertSame(${"email{$lineNumber}"}->name, trim($content));
}
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/SearchEmailTest.php | tests/Feature/SearchEmailTest.php | <?php
namespace Tests\Feature;
use App\Email;
use App\Search;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class SearchEmailTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_to_download_search_emails()
{
$search = factory(Search::class)->create();
$this
->get(route('search.emails', $search))
->assertStatus(Response::HTTP_FOUND)
->assertRedirect(route('login'));
}
/** @test */
public function a_user_cannot_download_another_user_search_emails()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user1->id]);
$this
->actingAs($user2)
->get(route('search.emails', $search))
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function a_user_can_download_search_emails()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$email0 = factory(Email::class)->create(['search_id' => $search->id]);
$email1 = factory(Email::class)->create(['search_id' => $search->id]);
$email2 = factory(Email::class)->create(['search_id' => $search->id]);
$response = $this
->actingAs($user)
->get(route('search.emails', $search));
$response->assertStatus(Response::HTTP_OK);
/** @var \Symfony\Component\HttpFoundation\File\File $file */
$file = $response->getFile();
$this->assertSame('txt', $file->guessExtension());
foreach ($file->openFile() as $lineNumber => $content) {
$this->assertSame(${"email{$lineNumber}"}->name, trim($content));
}
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/User/MeUserTest.php | tests/Feature/Api/User/MeUserTest.php | <?php
namespace Tests\Feature\Api\User;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class MeUserTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function only_authenticated_user_can_use_this_route()
{
$this
->getJson(route('api.users.me'))
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function it_should_show_the_curent_user()
{
$user = factory(User::class)->create()->fresh();
$response = $this
->actingAs($user, 'api')
->getJson(route('api.users.me'));
$response
->assertStatus(Response::HTTP_OK)
->assertJsonStructure(['data' => []])
->assertJson(['data' => $user->toArray()]);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/User/UpdateUserTest.php | tests/Feature/Api/User/UpdateUserTest.php | <?php
namespace Tests\Feature\Api\User;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class UpdateUserTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function only_authenticated_user_can_use_this_route()
{
$user = factory(User::class)->create();
$this
->putJson(route('api.users.update', $user))
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function a_user_cannot_update_another_user()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$this
->actingAs($user2, 'api')
->putJson(route('api.users.update', $user1))
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function it_should_update_a_user()
{
$user = factory(User::class)->create();
$update = ['name' => 'a new name', 'email' => 'new@example.com'];
$response = $this
->actingAs($user, 'api')
->putJson(route('api.users.update', $user), $update);
$response
->assertStatus(Response::HTTP_OK)
->assertJsonStructure(['data' => []])
->assertJsonFragment($update);
$this->assertDatabaseHas('users', array_merge($update, ['id' => $user->id]));
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/Search/ShowSearchStatisticsTest.php | tests/Feature/Api/Search/ShowSearchStatisticsTest.php | <?php
namespace Tests\Feature\Api\Search;
use App\Email;
use App\Search;
use App\Url;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class ShowSearchStatisticsTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_to_see_search_statistics()
{
$search = factory(Search::class)->create();
$this
->getJson(route('api.searches.statistics.show', $search))
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function a_user_cannot_see_another_user_search_statistics()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user1->id]);
$this
->actingAs($user2, 'api')
->getJson(route('api.searches.statistics.show', $search))
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function it_should_show_search_statistics()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$url1 = factory(Url::class)->states(['not_crawled'])->create(['search_id' => $search->id]);
$url2 = factory(Url::class)->states(['not_crawled'])->create(['search_id' => $search->id]);
$url3 = factory(Url::class)->states(['crawled'])->create(['search_id' => $search->id]);
$email1 = factory(Email::class)->create(['search_id' => $search->id]);
$email2 = factory(Email::class)->create(['search_id' => $search->id]);
$response = $this
->actingAs($user, 'api')
->getJson(route('api.searches.statistics.show', $search));
$response
->assertStatus(Response::HTTP_OK)
->assertJsonStructure(['data' => []])
->assertJsonFragment($search->toArray())
->assertJsonFragment(['urls_count' => '3'])
->assertJsonFragment(['not_crawled_urls_count' => '2'])
->assertJsonFragment(['crawled_urls_count' => '1'])
->assertJsonFragment(['emails_count' => '2']);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/Search/ShowSearchTest.php | tests/Feature/Api/Search/ShowSearchTest.php | <?php
namespace Tests\Feature\Api\Search;
use App\Search;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class ShowSearchTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_to_see_a_search()
{
$search = factory(Search::class)->create();
$this
->getJson(route('api.searches.show', $search))
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function a_user_cannot_see_another_user_search()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user1->id]);
$this
->actingAs($user2, 'api')
->getJson(route('api.searches.show', $search))
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function it_should_show_a_search()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$response = $this
->actingAs($user, 'api')
->getJson(route('api.searches.show', $search));
$response
->assertStatus(Response::HTTP_OK)
->assertJson(['data' => $search->toArray()]);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/Search/DestroySearchTest.php | tests/Feature/Api/Search/DestroySearchTest.php | <?php
namespace Tests\Feature\Api\Search;
use App\Search;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class DestroySearchTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_to_destroy_a_search()
{
$search = factory(Search::class)->create();
$this
->deleteJson(route('api.searches.destroy', $search))
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function a_user_cannot_delete_another_user_search()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user1->id]);
$this
->actingAs($user2, 'api')
->deleteJson(route('api.searches.destroy', $search))
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function it_should_destroy_a_search()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$this
->actingAs($user, 'api')
->deleteJson(route('api.searches.destroy', $search))
->assertStatus(Response::HTTP_NO_CONTENT);
$this->assertDatabaseMissing('searches', $search->toArray());
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/Search/UpdateSearchTest.php | tests/Feature/Api/Search/UpdateSearchTest.php | <?php
namespace Tests\Feature\Api\Search;
use App\Search;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class UpdateSearchTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_to_update_a_search()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$update = ['status' => Search::STATUS_PAUSED];
$this
->putJson(route('api.searches.update', $search), $update)
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function a_user_cannot_update_another_user_search()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user1->id]);
$update = ['status' => Search::STATUS_PAUSED];
$this
->actingAs($user2, 'api')
->putJson(route('api.searches.update', $search), $update)
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function it_should_update_a_search()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$update = ['status' => Search::STATUS_PAUSED];
$response = $this
->actingAs($user, 'api')
->putJson(route('api.searches.update', $search), $update);
$response
->assertStatus(Response::HTTP_OK)
->assertJsonStructure(['data' => []])
->assertJsonFragment(array_merge($search->toArray(), $update));
$this->assertDatabaseHas('searches', [
'id' => $search->id,
'status' => $update['status']
]);
}
/** @test */
public function is_limited_is_nullable()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$update = ['is_limited' => null];
$this
->actingAs($user, 'api')
->putJson(route('api.searches.update', $search), $update)
->assertStatus(Response::HTTP_OK);
}
/** @test */
public function is_limited_must_be_a_boolean()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$update = ['is_limited' => 'not a boolean'];
$this
->actingAs($user, 'api')
->putJson(route('api.searches.update', $search), $update)
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['message', 'errors' => ['is_limited' => []]]);
}
/** @test */
public function status_is_nullable()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$update = ['status' => null];
$this
->actingAs($user, 'api')
->putJson(route('api.searches.update', $search), $update)
->assertStatus(Response::HTTP_OK);
}
/** @test */
public function status_must_be_a_valid_status()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$update = ['status' => 'not a valid status'];
$this
->actingAs($user, 'api')
->putJson(route('api.searches.update', $search), $update)
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['message', 'errors' => ['status' => []]]);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/UserSearch/StoreUserSearchTest.php | tests/Feature/Api/UserSearch/StoreUserSearchTest.php | <?php
namespace Tests\Feature\Api\UserSearch;
use App\Jobs\CrawlJob;
use App\Search;
use App\User;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Bus;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class StoreUserSearchTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_to_create_a_search()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->make();
$this
->postJson(route('api.users.searches.store', $user), $search->toArray())
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function a_user_cannot_create_a_search_for_another_user()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$search = factory(Search::class)->make();
$this
->actingAs($user2, 'api')
->postJson(route('api.users.searches.store', $user1), $search->toArray())
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function it_should_store_a_new_user_search()
{
Bus::fake();
$user = factory(User::class)->create();
$search = factory(Search::class)->make(['user_id' => $user->id]);
$response = $this
->actingAs($user, 'api')
->postJson(route('api.users.searches.store', $user), $search->toArray());
$response
->assertStatus(Response::HTTP_OK)
->assertJsonStructure(['data' => []])
->assertJsonFragment($search->toArray());
$this->assertDatabaseHas('searches', $search->toArray());
Bus::assertDispatched(CrawlJob::class, function (CrawlJob $job) use ($search) {
return $job->search->url === $search->url;
});
}
/** @test */
public function url_is_required()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->make([
'user_id' => $user->id,
'url' => null
]);
$response = $this
->actingAs($user, 'api')
->postJson(route('api.users.searches.store', $user), $search->toArray());
$response
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['message', 'errors' => ['url' => []]]);
}
/** @test */
public function url_must_be_a_valid_url()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->make([
'user_id' => $user->id,
'url' => 'not a url'
]);
$response = $this
->actingAs($user, 'api')
->postJson(route('api.users.searches.store', $user), $search->toArray());
$response
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['message', 'errors' => ['url' => []]]);
}
/** @test */
public function is_limited_is_required()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->make([
'user_id' => $user->id,
'is_limited' => null
]);
$response = $this
->actingAs($user, 'api')
->postJson(route('api.users.searches.store', $user), $search->toArray());
$response
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['message', 'errors' => ['is_limited' => []]]);
}
/** @test */
public function is_limited_must_be_a_boolean()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->make(['user_id' => $user->id,])->toArray();
$search['is_limited'] = 'not a boolean';
$response = $this
->actingAs($user, 'api')
->postJson(route('api.users.searches.store', $user), $search);
$response
->assertStatus(Response::HTTP_UNPROCESSABLE_ENTITY)
->assertJsonStructure(['message', 'errors' => ['is_limited' => []]]);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Feature/Api/UserSearch/IndexUserSearchTest.php | tests/Feature/Api/UserSearch/IndexUserSearchTest.php | <?php
namespace Tests\Feature\Api\UserSearch;
use App\Search;
use App\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Response;
use Tests\TestCase;
class IndexUserSearchTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function a_user_has_to_be_authenticated_index_his_searches()
{
$user = factory(User::class)->create();
$this
->getJson(route('api.users.searches.index', $user))
->assertStatus(Response::HTTP_UNAUTHORIZED);
}
/** @test */
public function a_user_cannot_index_another_user_searches()
{
$user1 = factory(User::class)->create();
$user2 = factory(User::class)->create();
$this
->actingAs($user2, 'api')
->getJson(route('api.users.searches.index', $user1))
->assertStatus(Response::HTTP_FORBIDDEN);
}
/** @test */
public function it_should_index_user_searches()
{
$user = factory(User::class)->create();
$search1 = factory(Search::class)->create(['user_id' => $user->id]);
$search2 = factory(Search::class)->create(['user_id' => $user->id]);
$response = $this
->actingAs($user, 'api')
->getJson(route('api.users.searches.index', $user));
$response
->assertStatus(Response::HTTP_OK)
->assertJsonStructure(['data' => [], 'links' => []])
->assertJsonFragment($search1->toArray())
->assertJsonFragment($search2->toArray());
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Unit/EmailTest.php | tests/Unit/EmailTest.php | <?php
namespace Tests\Unit;
use App\Email;
use App\Search;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class EmailTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function it_should_typecast_its_attributes()
{
$email = factory(Email::class)->create();
$this->assertInternalType('integer', $email->search_id);
}
/** @test */
public function it_should_have_a_search_relationship()
{
$email = factory(Email::class)->create();
$this->assertInstanceOf(Search::class, $email->search);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Unit/UrlTest.php | tests/Unit/UrlTest.php | <?php
namespace Tests\Unit;
use App\Search;
use App\Url;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class UrlTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function it_should_typecast_its_attributes()
{
$url = factory(Url::class)->create();
$this->assertInternalType('integer', $url->search_id);
$this->assertInternalType('boolean', $url->is_crawled);
}
/** @test */
public function it_should_have_a_search_relationship()
{
$url = factory(Url::class)->create();
$this->assertInstanceOf(Search::class, $url->search);
}
/** @test */
public function it_should_have_an_is_not_crawled_attribute()
{
$url = factory(Url::class)->states(['not_crawled'])->create();
$this->assertSame(true, $url->is_not_crawled);
}
/** @test */
public function it_should_have_a_not_crawled_scope()
{
$urlCrawled = factory(Url::class)->states(['crawled'])->create();
$urlNotCrawled = factory(Url::class)->states(['not_crawled'])->create();
$this->assertSame(
$urlNotCrawled->fresh()->toArray(),
Url::notCrawled()->first()->toArray()
);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Unit/UserTest.php | tests/Unit/UserTest.php | <?php
namespace Tests\Unit;
use App\Email;
use App\Search;
use App\User;
use Illuminate\Support\Collection;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class UserTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function it_should_have_a_searches_relationship()
{
$user = factory(User::class)->create();
$this->assertInstanceOf(Collection::class, $user->searches);
}
/** @test */
public function it_should_have_an_emails_relationship()
{
$user = factory(User::class)->create();
$search = factory(Search::class)->create(['user_id' => $user->id]);
$email1 = factory(Email::class)->create(['search_id' => $search->id]);
$email2 = factory(Email::class)->create(['search_id' => $search->id]);
$email3 = factory(Email::class)->create(['search_id' => $search->id]);
$this->assertInstanceOf(Collection::class, $user->emails);
$this->assertCount(3, $user->emails);
$this->assertTrue($user->emails->contains($email1));
$this->assertTrue($user->emails->contains($email2));
$this->assertTrue($user->emails->contains($email3));
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/tests/Unit/SearchTest.php | tests/Unit/SearchTest.php | <?php
namespace Tests\Unit;
use App\Search;
use App\User;
use Illuminate\Support\Collection;
use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class SearchTest extends TestCase
{
use RefreshDatabase;
/** @test */
public function it_should_typecast_its_attributes()
{
$search = factory(Search::class)->create();
$this->assertInternalType('integer', $search->user_id);
$this->assertInternalType('boolean', $search->is_limited);
}
/** @test */
public function it_should_have_a_user_relationship()
{
$search = factory(Search::class)->create();
$this->assertInstanceOf(User::class, $search->user);
}
/** @test */
public function it_should_have_a_urls_relationship()
{
$search = factory(Search::class)->create();
$this->assertInstanceOf(Collection::class, $search->urls);
}
/** @test */
public function it_should_have_an_emails_relationship()
{
$search = factory(Search::class)->create();
$this->assertInstanceOf(Collection::class, $search->emails);
}
/** @test */
public function it_should_have_a_is_created_attribute()
{
$search = factory(Search::class)->states('created')->create();
$this->assertSame(true, $search->is_created);
}
/** @test */
public function it_should_have_a_is_running_attribute()
{
$search = factory(Search::class)->states('running')->create();
$this->assertSame(true, $search->is_running);
}
/** @test */
public function it_should_have_a_is_finished_attribute()
{
$search = factory(Search::class)->states('finished')->create();
$this->assertSame(true, $search->is_finished);
}
/** @test */
public function it_should_have_a_is_failed_attribute()
{
$search = factory(Search::class)->states('failed')->create();
$this->assertSame(true, $search->is_failed);
}
/** @test */
public function it_should_have_a_domain_attribute()
{
$this->assertSame(
'http://example.com',
factory(Search::class)->create(['url' => 'http://example.com'])->domain
);
$this->assertSame(
'https://example.com',
factory(Search::class)->create(['url' => 'https://example.com'])->domain
);
$this->assertSame(
'http://example.com',
factory(Search::class)->create(['url' => 'http://example.com/'])->domain
);
$this->assertSame(
'http://example.com',
factory(Search::class)->create(['url' => 'http://example.com/some-path?foo=bar'])->domain
);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/routes/web.php | routes/web.php | <?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Auth::routes();
Route::get('/', 'HomeController')->name('home');
Route::group(['middleware' => 'auth'], function () {
Route::get('dashboard', 'DashboardController')->name('dashboard');
Route::get('searches/{search}/emails', 'SearchEmailController')->middleware('can:view,search')->name('search.emails');
Route::get('users/{user}/emails', 'UserEmailController')->middleware('can:view,user')->name('user.emails');
});
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/routes/channels.php | routes/channels.php | <?php
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/routes/api.php | routes/api.php | <?php
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::get('/', 'ApiController@apiIndex')->name('api.index');
Route::group(['middleware' => 'auth:api'], function () {
Route::get('users/me', 'UserController@me')->name('api.users.me');
Route::put('users/{user}', 'UserController@update')->middleware('can:update,user')->name('api.users.update');
Route::get('users/{user}/searches', 'UserSearchController@index')->middleware('can:view,user')->name('api.users.searches.index');
Route::post('users/{user}/searches', 'UserSearchController@store')->middleware(['can:view,user', 'can:create,App\Search'])->name('api.users.searches.store');
Route::get('searches/{search}', 'SearchController@show')->middleware('can:view,search')->name('api.searches.show');
Route::put('searches/{search}', 'SearchController@update')->middleware('can:update,search')->name('api.searches.update');
Route::delete('searches/{search}', 'SearchController@destroy')->middleware('can:delete,search')->name('api.searches.destroy');
Route::get('searches/{search}/statistics', 'SearchStatisticsController@show')->middleware('can:view,search')->name('api.searches.statistics.show');
});
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/routes/console.php | routes/console.php | <?php
/*
|--------------------------------------------------------------------------
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/public/index.php | public/index.php | <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylor@laravel.com>
*/
define('LARAVEL_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/
require __DIR__.'/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = require_once __DIR__.'/../bootstrap/app.php';
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/app.php | config/app.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'en',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
Illuminate\Cache\CacheServiceProvider::class,
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
Illuminate\Cookie\CookieServiceProvider::class,
Illuminate\Database\DatabaseServiceProvider::class,
Illuminate\Encryption\EncryptionServiceProvider::class,
Illuminate\Filesystem\FilesystemServiceProvider::class,
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
Illuminate\Hashing\HashServiceProvider::class,
Illuminate\Mail\MailServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Illuminate\Pagination\PaginationServiceProvider::class,
Illuminate\Pipeline\PipelineServiceProvider::class,
Illuminate\Queue\QueueServiceProvider::class,
Illuminate\Redis\RedisServiceProvider::class,
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
Illuminate\Session\SessionServiceProvider::class,
Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class,
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/logging.php | config/logging.php | <?php
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'Laravel Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/session.php | config/session.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => env('SESSION_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,
/*
|--------------------------------------------------------------------------
| Session Encryption
|--------------------------------------------------------------------------
|
| This option allows you to easily specify that all of your session data
| should be encrypted before it is stored. All encryption will be run
| automatically by Laravel and you can use the Session like normal.
|
*/
'encrypt' => false,
/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/
'files' => storage_path('framework/sessions'),
/*
|--------------------------------------------------------------------------
| Session Database Connection
|--------------------------------------------------------------------------
|
| When using the "database" or "redis" session drivers, you may specify a
| connection that should be used to manage these sessions. This should
| correspond to a connection in your database configuration options.
|
*/
'connection' => env('SESSION_CONNECTION', null),
/*
|--------------------------------------------------------------------------
| Session Database Table
|--------------------------------------------------------------------------
|
| When using the "database" session driver, you may specify the table we
| should use to manage the sessions. Of course, a sensible default is
| provided for you; however, you are free to change this as needed.
|
*/
'table' => 'sessions',
/*
|--------------------------------------------------------------------------
| Session Cache Store
|--------------------------------------------------------------------------
|
| When using the "apc" or "memcached" session drivers, you may specify a
| cache store that should be used for these sessions. This value must
| correspond with one of the application's configured cache stores.
|
*/
'store' => env('SESSION_STORE', null),
/*
|--------------------------------------------------------------------------
| Session Sweeping Lottery
|--------------------------------------------------------------------------
|
| Some session drivers must manually sweep their storage location to get
| rid of old sessions from storage. Here are the chances that it will
| happen on a given request. By default, the odds are 2 out of 100.
|
*/
'lottery' => [2, 100],
/*
|--------------------------------------------------------------------------
| Session Cookie Name
|--------------------------------------------------------------------------
|
| Here you may change the name of the cookie used to identify a session
| instance by ID. The name specified here will get used every time a
| new session cookie is created by the framework for every driver.
|
*/
'cookie' => env(
'SESSION_COOKIE',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
/*
|--------------------------------------------------------------------------
| Session Cookie Path
|--------------------------------------------------------------------------
|
| The session cookie path determines the path for which the cookie will
| be regarded as available. Typically, this will be the root path of
| your application but you are free to change this when necessary.
|
*/
'path' => '/',
/*
|--------------------------------------------------------------------------
| Session Cookie Domain
|--------------------------------------------------------------------------
|
| Here you may change the domain of the cookie used to identify a session
| in your application. This will determine which domains the cookie is
| available to in your application. A sensible default has been set.
|
*/
'domain' => env('SESSION_DOMAIN', null),
/*
|--------------------------------------------------------------------------
| HTTPS Only Cookies
|--------------------------------------------------------------------------
|
| By setting this option to true, session cookies will only be sent back
| to the server if the browser has a HTTPS connection. This will keep
| the cookie from being sent to you if it can not be done securely.
|
*/
'secure' => env('SESSION_SECURE_COOKIE', false),
/*
|--------------------------------------------------------------------------
| HTTP Access Only
|--------------------------------------------------------------------------
|
| Setting this value to true will prevent JavaScript from accessing the
| value of the cookie and the cookie will only be accessible through
| the HTTP protocol. You are free to modify this option if needed.
|
*/
'http_only' => true,
/*
|--------------------------------------------------------------------------
| Same-Site Cookies
|--------------------------------------------------------------------------
|
| This option determines how your cookies behave when cross-site requests
| take place, and can be used to mitigate CSRF attacks. By default, we
| do not enable this as other CSRF protection services are in place.
|
| Supported: "lax", "strict"
|
*/
'same_site' => null,
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/queue.php | config/queue.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Queue Connection Name
|--------------------------------------------------------------------------
|
| Laravel's queue API supports an assortment of back-ends via a single
| API, giving you convenient access to each back-end using the same
| syntax for every one. Here you may define a default connection.
|
*/
'default' => env('QUEUE_CONNECTION', 'sync'),
/*
|--------------------------------------------------------------------------
| Queue Connections
|--------------------------------------------------------------------------
|
| Here you may configure the connection information for each server that
| is used by your application. A default configuration has been added
| for each back-end shipped with Laravel. You are free to add more.
|
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
*/
'connections' => [
'sync' => [
'driver' => 'sync',
],
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 90,
],
'beanstalkd' => [
'driver' => 'beanstalkd',
'host' => 'localhost',
'queue' => 'default',
'retry_after' => 90,
],
'sqs' => [
'driver' => 'sqs',
'key' => env('SQS_KEY', 'your-public-key'),
'secret' => env('SQS_SECRET', 'your-secret-key'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('SQS_REGION', 'us-east-1'),
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
'queue' => env('REDIS_QUEUE', 'default'),
'retry_after' => 90,
'block_for' => null,
],
],
/*
|--------------------------------------------------------------------------
| Failed Queue Jobs
|--------------------------------------------------------------------------
|
| These options configure the behavior of failed queue job logging so you
| can control which database and table are used to store the jobs that
| have failed. You may change them to any database / table you wish.
|
*/
'failed' => [
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/cache.php | config/cache.php | <?php
use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
| Supported: "apc", "array", "database", "file", "memcached", "redis"
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
*/
'stores' => [
'apc' => [
'driver' => 'apc',
],
'array' => [
'driver' => 'array',
],
'database' => [
'driver' => 'database',
'table' => 'cache',
'connection' => null,
],
'file' => [
'driver' => 'file',
'path' => storage_path('framework/cache/data'),
],
'memcached' => [
'driver' => 'memcached',
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
'sasl' => [
env('MEMCACHED_USERNAME'),
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
'port' => env('MEMCACHED_PORT', 11211),
'weight' => 100,
],
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'cache',
],
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/hashing.php | config/hashing.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
'rounds' => env('BCRYPT_ROUNDS', 10),
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [
'memory' => 1024,
'threads' => 2,
'time' => 2,
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/view.php | config/view.php | <?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'),
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/database.php | config/database.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
'sqlite' => [
'driver' => 'sqlite',
'database' => env('DB_DATABASE', database_path('database.sqlite')),
'prefix' => '',
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
],
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
],
'pgsql' => [
'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
'schema' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
'prefix_indexes' => true,
],
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DB', 0),
],
'cache' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
],
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/services.php | config/services.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Stripe, Mailgun, SparkPost and others. This file provides a sane
| default location for this type of information, allowing packages
| to have a conventional place to find your various credentials.
|
*/
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
],
'ses' => [
'key' => env('SES_KEY'),
'secret' => env('SES_SECRET'),
'region' => env('SES_REGION', 'us-east-1'),
],
'sparkpost' => [
'secret' => env('SPARKPOST_SECRET'),
],
'stripe' => [
'model' => App\User::class,
'key' => env('STRIPE_KEY'),
'secret' => env('STRIPE_SECRET'),
'webhook' => [
'secret' => env('STRIPE_WEBHOOK_SECRET'),
'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300),
],
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/filesystems.php | config/filesystems.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/mail.php | config/mail.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
|
| Laravel supports both SMTP and PHP's "mail" function as drivers for the
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
| Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses",
| "sparkpost", "log", "array"
|
*/
'driver' => env('MAIL_DRIVER', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP Host Address
|--------------------------------------------------------------------------
|
| Here you may provide the host address of the SMTP server used by your
| applications. A default option is provided that is compatible with
| the Mailgun mail service which will provide reliable deliveries.
|
*/
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
| SMTP Host Port
|--------------------------------------------------------------------------
|
| This is the SMTP port used by your application to deliver e-mails to
| users of the application. Like the host we have set this value to
| stay compatible with the Mailgun e-mail application by default.
|
*/
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------
| Sendmail System Path
|--------------------------------------------------------------------------
|
| When using the "sendmail" driver to send e-mails, we will need to know
| the path to where Sendmail lives on this server. A default path has
| been provided here, which will work well on most of your systems.
|
*/
'sendmail' => '/usr/sbin/sendmail -bs',
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
/*
|--------------------------------------------------------------------------
| Log Channel
|--------------------------------------------------------------------------
|
| If you are using the "log" driver, you may specify the logging channel
| if you prefer to keep mail messages separate from other log entries
| for simpler reading. Otherwise, the default channel will be used.
|
*/
'log_channel' => env('MAIL_LOG_CHANNEL'),
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/broadcasting.php | config/broadcasting.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],
'redis' => [
'driver' => 'redis',
'connection' => 'default',
],
'log' => [
'driver' => 'log',
],
'null' => [
'driver' => 'null',
],
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/config/auth.php | config/auth.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
'guard' => 'web',
'passwords' => 'users',
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session", "token"
|
*/
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'passport',
'provider' => 'users',
],
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => App\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
'users' => [
'provider' => 'users',
'table' => 'password_resets',
'expire' => 60,
],
],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/seeds/UsersTableSeeder.php | database/seeds/UsersTableSeeder.php | <?php
use App\User;
use Illuminate\Database\Seeder;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(User::class)->create([
'name' => 'test',
'email' => 'test@example.com'
]);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/seeds/DatabaseSeeder.php | database/seeds/DatabaseSeeder.php | <?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->call(UsersTableSeeder::class);
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/factories/UrlFactory.php | database/factories/UrlFactory.php | <?php
use App\Search;
use App\Url;
use Faker\Generator as Faker;
$factory->define(Url::class, function (Faker $faker) {
return [
'name' => $faker->url,
'search_id' => function () {
return factory(Search::class)->create()->id;
},
'is_crawled' => $faker->boolean
];
});
$factory->state(Url::class, 'crawled', ['is_crawled' => true]);
$factory->state(Url::class, 'not_crawled', ['is_crawled' => false]); | php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/factories/EmailFactory.php | database/factories/EmailFactory.php | <?php
use App\Email;
use App\Search;
use Faker\Generator as Faker;
$factory->define(Email::class, function (Faker $faker) {
return [
'name' => $faker->safeEmail,
'search_id' => function () {
return factory(Search::class)->create()->id;
}
];
});
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/factories/UserFactory.php | database/factories/UserFactory.php | <?php
use App\User;
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(User::class, function (Faker $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10)
];
});
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/factories/SearchFactory.php | database/factories/SearchFactory.php | <?php
use App\Search;
use App\User;
use Faker\Generator as Faker;
$factory->define(Search::class, function (Faker $faker) {
return [
'url' => $faker->url,
'user_id' => function () {
return factory(User::class)->create()->id;
},
'is_limited' => $faker->boolean,
'pid' => null
];
});
$factory->state(Search::class, 'created', ['status' => Search::STATUS_CREATED]);
$factory->state(Search::class, 'running', ['status' => Search::STATUS_RUNNING]);
$factory->state(Search::class, 'finished', ['status' => Search::STATUS_FINISHED]);
$factory->state(Search::class, 'paused', ['status' => Search::STATUS_PAUSED]);
$factory->state(Search::class, 'failed', ['status' => Search::STATUS_FAILED]);
$factory->state(Search::class, 'limited', ['is_limited' => true]);
$factory->state(Search::class, 'unlimited', ['is_limited' => false]);
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2016_06_01_000004_create_oauth_clients_table.php | database/migrations/2016_06_01_000004_create_oauth_clients_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOauthClientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_clients', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->index()->nullable();
$table->string('name');
$table->string('secret', 100);
$table->text('redirect');
$table->boolean('personal_access_client');
$table->boolean('password_client');
$table->boolean('revoked');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('oauth_clients');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2014_10_12_000000_create_users_table.php | database/migrations/2014_10_12_000000_create_users_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2018_01_19_205205_create_searches_table.php | database/migrations/2018_01_19_205205_create_searches_table.php | <?php
use App\Search;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSearchesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('searches', function (Blueprint $table) {
$table->increments('id');
$table->text('url');
$table->unsignedInteger('user_id');
$table->enum('status', [
Search::STATUS_CREATED,
Search::STATUS_RUNNING,
Search::STATUS_FINISHED,
Search::STATUS_PAUSED,
Search::STATUS_FAILED
])->default(Search::STATUS_CREATED);
$table->boolean('is_limited')->default(true);
$table->string('pid')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('searches');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2018_01_19_212151_create_urls_table.php | database/migrations/2018_01_19_212151_create_urls_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUrlsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('urls', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->index();
$table->unsignedInteger('search_id');
$table->boolean('is_crawled')->default(false);
$table->unique(['name', 'search_id']);
$table->foreign('search_id')
->references('id')->on('searches')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('urls');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2014_10_12_100000_create_password_resets_table.php | database/migrations/2014_10_12_100000_create_password_resets_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2018_01_19_203819_create_sessions_table.php | database/migrations/2018_01_19_203819_create_sessions_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSessionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sessions', function (Blueprint $table) {
$table->string('id')->unique();
$table->unsignedInteger('user_id')->nullable();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->text('payload');
$table->integer('last_activity');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sessions');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php | database/migrations/2016_06_01_000005_create_oauth_personal_access_clients_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOauthPersonalAccessClientsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_personal_access_clients', function (Blueprint $table) {
$table->increments('id');
$table->integer('client_id')->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('oauth_personal_access_clients');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php | database/migrations/2016_06_01_000002_create_oauth_access_tokens_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOauthAccessTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_access_tokens', function (Blueprint $table) {
$table->string('id', 100)->primary();
$table->integer('user_id')->index()->nullable();
$table->integer('client_id');
$table->string('name')->nullable();
$table->text('scopes')->nullable();
$table->boolean('revoked');
$table->timestamps();
$table->dateTime('expires_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('oauth_access_tokens');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2018_01_19_213937_create_emails_table.php | database/migrations/2018_01_19_213937_create_emails_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateEmailsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('emails', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->index();
$table->unsignedInteger('search_id');
$table->unique(['name', 'search_id']);
$table->foreign('search_id')
->references('id')->on('searches')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('emails');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php | database/migrations/2016_06_01_000003_create_oauth_refresh_tokens_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOauthRefreshTokensTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_refresh_tokens', function (Blueprint $table) {
$table->string('id', 100)->primary();
$table->string('access_token_id', 100)->index();
$table->boolean('revoked');
$table->dateTime('expires_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('oauth_refresh_tokens');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php | database/migrations/2016_06_01_000001_create_oauth_auth_codes_table.php | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOauthAuthCodesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_auth_codes', function (Blueprint $table) {
$table->string('id', 100)->primary();
$table->integer('user_id');
$table->integer('client_id');
$table->text('scopes')->nullable();
$table->boolean('revoked');
$table->dateTime('expires_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('oauth_auth_codes');
}
}
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/lang/en/passwords.php | resources/lang/en/passwords.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Password Reset Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are the default lines which match reasons
| that are given by the password broker for a password update attempt
| has failed, such as for an invalid token or invalid new password.
|
*/
'password' => 'Passwords must be at least six characters and match the confirmation.',
'reset' => 'Your password has been reset!',
'sent' => 'We have e-mailed your password reset link!',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that e-mail address.",
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/lang/en/pagination.php | resources/lang/en/pagination.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Pagination Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used by the paginator library to build
| the simple pagination links. You are free to change them to anything
| you want to customize your views to better match your application.
|
*/
'previous' => '« Previous',
'next' => 'Next »',
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/lang/en/validation.php | resources/lang/en/validation.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'accepted' => 'The :attribute must be accepted.',
'active_url' => 'The :attribute is not a valid URL.',
'after' => 'The :attribute must be a date after :date.',
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
'alpha' => 'The :attribute may only contain letters.',
'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.',
'alpha_num' => 'The :attribute may only contain letters and numbers.',
'array' => 'The :attribute must be an array.',
'before' => 'The :attribute must be a date before :date.',
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
'between' => [
'numeric' => 'The :attribute must be between :min and :max.',
'file' => 'The :attribute must be between :min and :max kilobytes.',
'string' => 'The :attribute must be between :min and :max characters.',
'array' => 'The :attribute must have between :min and :max items.',
],
'boolean' => 'The :attribute field must be true or false.',
'confirmed' => 'The :attribute confirmation does not match.',
'date' => 'The :attribute is not a valid date.',
'date_format' => 'The :attribute does not match the format :format.',
'different' => 'The :attribute and :other must be different.',
'digits' => 'The :attribute must be :digits digits.',
'digits_between' => 'The :attribute must be between :min and :max digits.',
'dimensions' => 'The :attribute has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'email' => 'The :attribute must be a valid email address.',
'exists' => 'The selected :attribute is invalid.',
'file' => 'The :attribute must be a file.',
'filled' => 'The :attribute field must have a value.',
'image' => 'The :attribute must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field does not exist in :other.',
'integer' => 'The :attribute must be an integer.',
'ip' => 'The :attribute must be a valid IP address.',
'ipv4' => 'The :attribute must be a valid IPv4 address.',
'ipv6' => 'The :attribute must be a valid IPv6 address.',
'json' => 'The :attribute must be a valid JSON string.',
'max' => [
'numeric' => 'The :attribute may not be greater than :max.',
'file' => 'The :attribute may not be greater than :max kilobytes.',
'string' => 'The :attribute may not be greater than :max characters.',
'array' => 'The :attribute may not have more than :max items.',
],
'mimes' => 'The :attribute must be a file of type: :values.',
'mimetypes' => 'The :attribute must be a file of type: :values.',
'min' => [
'numeric' => 'The :attribute must be at least :min.',
'file' => 'The :attribute must be at least :min kilobytes.',
'string' => 'The :attribute must be at least :min characters.',
'array' => 'The :attribute must have at least :min items.',
],
'not_in' => 'The selected :attribute is invalid.',
'numeric' => 'The :attribute must be a number.',
'present' => 'The :attribute field must be present.',
'regex' => 'The :attribute format is invalid.',
'required' => 'The :attribute field is required.',
'required_if' => 'The :attribute field is required when :other is :value.',
'required_unless' => 'The :attribute field is required unless :other is in :values.',
'required_with' => 'The :attribute field is required when :values is present.',
'required_with_all' => 'The :attribute field is required when :values is present.',
'required_without' => 'The :attribute field is required when :values is not present.',
'required_without_all' => 'The :attribute field is required when none of :values are present.',
'same' => 'The :attribute and :other must match.',
'size' => [
'numeric' => 'The :attribute must be :size.',
'file' => 'The :attribute must be :size kilobytes.',
'string' => 'The :attribute must be :size characters.',
'array' => 'The :attribute must contain :size items.',
],
'string' => 'The :attribute must be a string.',
'timezone' => 'The :attribute must be a valid zone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'url' => 'The :attribute format is invalid.',
/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "attribute.rule" to name the lines. This makes it quick to
| specify a specific custom language line for a given attribute rule.
|
*/
'custom' => [
'attribute-name' => [
'rule-name' => 'custom-message',
],
],
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap attribute place-holders
| with something more reader friendly such as E-Mail Address instead
| of "email". This simply helps us make messages a little cleaner.
|
*/
'attributes' => [],
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/lang/en/auth.php | resources/lang/en/auth.php | <?php
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/dashboard.blade.php | resources/views/dashboard.blade.php | @extends('layouts.app')
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 col-xl-3">
<ul class="nav flex-column mb-4">
<li class="nav-item">
<router-link :to="{ name: 'dashboard' }"
class="nav-link">
Dashboard
</router-link>
</li>
<li class="nav-item">
<router-link :to="{ name: 'searches.index' }"
class="nav-link">
Searches
</router-link>
</li>
<li class="nav-item">
<router-link :to="{ name: 'account.edit' }"
class="nav-link">
My account
</router-link>
</li>
</ul>
</div>
<div class="col-lg-10 col-xl-9">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<transition name="fade">
<router-view></router-view>
</transition>
</div>
</div>
</div>
@endsection
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/home.blade.php | resources/views/home.blade.php | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row">
<div class="col-md-12">
Home page
</div>
</div>
</div>
@endsection
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/auth/login.blade.php | resources/views/auth/login.blade.php | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col col-sm-10 col-md-9 col-lg-6 col-xl-6">
<div class="card">
<div class="card-header">
Login
</div>
<div class="card-body">
<form class="form-horizontal" method="POST" action="{{ route('login') }}">
{{ csrf_field() }}
<div class="form-group">
<label for="email"
class="form-control-label">
E-Mail Address
</label>
<input id="email"
type="email"
class="form-control {{ $errors->has('email') ? ' is-invalid' : '' }}"
name="email"
value="{{ old('email') }}"
required
autofocus>
@if ($errors->has('email'))
<div class="invalid-feedback">
{{ $errors->first('email') }}
</div>
@endif
</div>
<div class="form-group">
<label for="password"
class="form-control-label">
Password
</label>
<input id="password"
type="password"
class="form-control {{ $errors->has('password') ? ' is-invalid' : '' }}"
name="password"
required>
@if ($errors->has('password'))
<div class="invalid-feedback">
{{ $errors->first('password') }}
</div>
@endif
</div>
<div class="form-group">
<div class="form-check">
<input id="remember"
type="checkbox"
name="remember"
{{ old('remember') ? 'checked' : '' }}
class="form-check-input {{ $errors->has('remember') ? ' is-invalid' : '' }}">
<label for="remember"
class="form-check-label">
Remember Me
</label>
</div>
@if ($errors->has('remember'))
<div class="invalid-feedback">
{{ $errors->first('remember') }}
</div>
@endif
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">
Login
</button>
<a class="btn btn-link" href="{{ route('password.request') }}">
Forgot Your Password?
</a>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/auth/register.blade.php | resources/views/auth/register.blade.php | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col col-sm-10 col-md-9 col-lg-6 col-xl-6">
<div class="card">
<div class="card-header">
Register
</div>
<div class="card-body">
<form class="form-horizontal" method="POST" action="{{ route('register') }}">
{{ csrf_field() }}
<div class="form-group">
<label for="email"
class="form-control-label">
Name
</label>
<input id="name"
type="text"
class="form-control {{ $errors->has('name') ? ' is-invalid' : '' }}"
name="name"
value="{{ old('name') }}"
required
autofocus>
@if ($errors->has('name'))
<div class="invalid-feedback">
{{ $errors->first('name') }}
</div>
@endif
</div>
<div class="form-group">
<label for="email"
class="form-control-label">
E-Mail Address
</label>
<input id="email"
type="email"
class="form-control {{ $errors->has('email') ? ' is-invalid' : '' }}"
name="email"
value="{{ old('email') }}"
required
autofocus>
@if ($errors->has('email'))
<div class="invalid-feedback">
{{ $errors->first('email') }}
</div>
@endif
</div>
<div class="form-group">
<label for="password"
class="form-control-label">
Password
</label>
<input id="password"
type="password"
class="form-control {{ $errors->has('password') ? ' is-invalid' : '' }}"
name="password"
required>
@if ($errors->has('password'))
<div class="invalid-feedback">
{{ $errors->first('password') }}
</div>
@endif
</div>
<div class="form-group">
<label for="password-confirm">
Confirm Password
</label>
<input id="password-confirm"
type="password"
class="form-control"
name="password_confirmation"
required>
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/auth/passwords/email.blade.php | resources/views/auth/passwords/email.blade.php | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col col-sm-10 col-md-9 col-lg-6 col-xl-6">
<div class="card">
<div class="card-header">
Reset Password
</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success" role="alert">
{{ session('status') }}
</div>
@endif
<form class="form-horizontal" method="POST" action="{{ route('password.email') }}">
{{ csrf_field() }}
<div class="form-group">
<label for="email"
class="form-control-label">
E-Mail Address
</label>
<input id="email"
type="email"
class="form-control {{ $errors->has('email') ? ' is-invalid' : '' }}"
name="email"
value="{{ old('email') }}"
required
autofocus>
@if ($errors->has('email'))
<div class="invalid-feedback">
{{ $errors->first('email') }}
</div>
@endif
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">
Send Password Reset Link
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/auth/passwords/reset.blade.php | resources/views/auth/passwords/reset.blade.php | @extends('layouts.app')
@section('content')
<div class="container">
<div class="row align-items-center justify-content-center">
<div class="col col-sm-10 col-md-9 col-lg-6 col-xl-6">
<div class="card">
<div class="card-header">
Reset Password
</div>
<div class="card-body">
<form class="form-horizontal" method="POST" action="{{ route('password.request') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
<div class="form-group">
<label for="email"
class="form-control-label">
E-Mail Address
</label>
<input id="email"
type="email"
class="form-control {{ $errors->has('email') ? ' is-invalid' : '' }}"
name="email"
value="{{ old('email') }}"
required
autofocus>
@if ($errors->has('email'))
<div class="invalid-feedback">
{{ $errors->first('email') }}
</div>
@endif
</div>
<div class="form-group">
<label for="password"
class="form-control-label">
Password
</label>
<input id="password"
type="password"
class="form-control {{ $errors->has('password') ? ' is-invalid' : '' }}"
name="password"
required>
@if ($errors->has('password'))
<div class="invalid-feedback">
{{ $errors->first('password') }}
</div>
@endif
</div>
<div class="form-group">
<label for="password-confirm">
Confirm Password
</label>
<input id="password-confirm"
type="password"
class="form-control {{ $errors->has('password_confirmation') ? ' is-invalid' : '' }}"
name="password_confirmation"
required>
@if ($errors->has('password_confirmation'))
<div class="invalid-feedback">
{{ $errors->first('password_confirmation') }}
</div>
@endif
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary">
Reset Password
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/partials/header.blade.php | resources/views/partials/header.blade.php | <header class="site-header">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</a>
<button class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse"
id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
@guest
<li class="nav-item">
<a class="nav-link"
href="{{ route('login') }}">
Login
</a>
</li>
<li class="nav-item">
<a class="nav-link"
href="{{ route('register') }}">
Register
</a>
</li>
@else
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle"
href="#"
id="navbarDropdown"
role="button"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
{{ Auth::user()->name }}
</a>
<div class="dropdown-menu"
aria-labelledby="navbarDropdown">
<a class="dropdown-item"
href="{{ route('logout') }}"
onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
Logout
</a>
<form id="logout-form"
action="{{ route('logout') }}"
method="POST"
style="display: none;">
{{ csrf_field() }}
</form>
</div>
</li>
@endguest
</ul>
</div>
</nav>
</header>
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/partials/footer.blade.php | resources/views/partials/footer.blade.php | <footer class="site-footer">
<div class="container">
<div class="row">
<div class="col">
<!--
<p class="text-muted text-center">
©{{ date('Y') }} {{ config('app.name') }}
</p>
-->
</div>
</div>
</div>
</footer>
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/partials/main.blade.php | resources/views/partials/main.blade.php | <main class="site-main" role="main">
@yield('content')
</main>
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
hedii/php-crawler | https://github.com/hedii/php-crawler/blob/9de07a738468d0821993b098d9917146eb4365fb/resources/views/layouts/app.blade.php | resources/views/layouts/app.blade.php | <!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<script>
window.apiUrl = '{{ route('api.index') }}';
window.apiRoutes = @json(routes_to_array('api'));
</script>
</head>
<body>
<div id="app">
@include('partials.header')
@include('partials.main')
@include('partials.footer')
</div>
<script src="{{ mix('js/app.js') }}"></script>
</body>
</html>
| php | MIT | 9de07a738468d0821993b098d9917146eb4365fb | 2026-01-05T05:03:37.929921Z | false |
vemcogroup/laravel-translation | https://github.com/vemcogroup/laravel-translation/blob/6bec99ffd1a5da6c1e53e3732203dd2c701b4aaa/src/TranslationServiceProvider.php | src/TranslationServiceProvider.php | <?php
namespace Vemcogroup\Translation;
use Illuminate\Support\ServiceProvider;
use Vemcogroup\Translation\Commands\Scan;
use Vemcogroup\Translation\Commands\Upload;
use Vemcogroup\Translation\Commands\Download;
use Vemcogroup\Translation\Commands\CreateJs;
use Vemcogroup\Translation\Commands\AddTerms;
class TranslationServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->publishes([
__DIR__ . '/../config/translation.php' => config_path('translation.php'),
], 'config');
if ($this->app->runningInConsole()) {
$this->commands([
Scan::class,
Upload::class,
Download::class,
CreateJs::class,
AddTerms::class,
]);
}
}
public function register(): void
{
$this->mergeConfigFrom(
__DIR__ . '/../config/translation.php', 'translation'
);
$this->app->singleton(Translation::class, function () {
return new Translation();
});
}
}
| php | MIT | 6bec99ffd1a5da6c1e53e3732203dd2c701b4aaa | 2026-01-05T05:03:46.176465Z | false |
vemcogroup/laravel-translation | https://github.com/vemcogroup/laravel-translation/blob/6bec99ffd1a5da6c1e53e3732203dd2c701b4aaa/src/Translation.php | src/Translation.php | <?php
namespace Vemcogroup\Translation;
use Exception;
use GuzzleHttp\Client;
use Illuminate\Support\Collection;
use Symfony\Component\Finder\Finder;
use GuzzleHttp\Exception\GuzzleException;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\HttpFoundation\Response;
use GuzzleHttp\Psr7\Response as GuzzleResponse;
use Vemcogroup\Translation\Exceptions\POEditorException;
use const DIRECTORY_SEPARATOR;
class Translation
{
protected $apiKey;
protected $projectId;
protected $baseLanguage;
protected $baseFilename;
protected $skipTrimming;
public function __construct()
{
$this->baseLanguage = config('translation.base_language');
$this->baseFilename = app()->langPath() . DIRECTORY_SEPARATOR . $this->baseLanguage . '.json';
}
public function scan($mergeKeys = false): int
{
$allMatches = [];
$finder = new Finder();
$finder->in(base_path())
->exclude(config('translation.excluded_directories'))
->name(config('translation.extensions'))
->followLinks()
->files();
/*
* This pattern is derived from Barryvdh\TranslationManager by Barry vd. Heuvel <barryvdh@gmail.com>
*
* https://github.com/barryvdh/laravel-translation-manager/blob/master/src/Manager.php
*/
$functions = config('translation.functions');
$pattern =
// See https://regex101.com/r/jS5fX0/5
'[^\w]' . // Must not start with any alphanum or _
'(?<!->)' . // Must not start with ->
'(?:' . implode('|', $functions) . ')' . // Must start with one of the functions
"\(" . // Match opening parentheses
"\s*" . // Allow whitespace chars after the opening parenthese
'(?:' . // Non capturing group
"'(.+)'" . // Match 'text'
'|' . // or
"`(.+)`" . // Match `text`
'|' . // or
"\"(.+)\"" . // Match "text"
')' . // Close non-capturing group
"\s*" . // Allow whitespace chars before the closing parenthese
"[\),]" // Close parentheses or new parameter
;
foreach ($finder as $file) {
if (preg_match_all("/$pattern/siU", $file->getContents(), $matches)) {
unset($matches[0]);
$allMatches[$file->getRelativePathname()] =
array_filter(
array_merge(...$matches),
function ($value) {
return (!is_null($value)) && !empty($value);
}
);
}
}
$collapsedKeys = collect($allMatches)->collapse();
$keys = $collapsedKeys->combine($collapsedKeys);
if ($mergeKeys) {
$content = $this->getFileContent();
$keys = $content->union(
$keys->filter(function ($key) use ($content) {
return !$content->has($key);
})
);
}
file_put_contents($this->baseFilename, json_encode($keys->sortKeys(), JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
return $keys->count();
}
public function createJs(): int
{
$jsLangPath = config('translation.output_directory');
if (!is_dir($jsLangPath) && !mkdir($jsLangPath, 0777, true)) {
throw POEditorException::unableToCreateJsDirectory($jsLangPath);
}
$translations = $this->getTranslations();
$translations->each(function ($content, $language) use ($jsLangPath) {
$content = 'window.i18n = ' . json_encode($content) . ';';
file_put_contents($jsLangPath . DIRECTORY_SEPARATOR . $language . '.js', $content);
});
return $translations->count();
}
public function download($skipTrimming = false): Collection
{
try {
$this->setupPoeditorCredentials();
$response = $this->query('https://api.poeditor.com/v2/languages/list', [
'form_params' => [
'api_token' => $this->apiKey,
'id' => $this->projectId
]
], 'POST');
} catch (Exception $e) {
throw $e;
}
$languages = collect($response['result']['languages']);
$this->skipTrimming = $skipTrimming;
$languages->each(function ($language) {
$response = $this->query('https://api.poeditor.com/v2/projects/export', [
'form_params' => [
'api_token' => $this->apiKey,
'id' => $this->projectId,
'language' => $language['code'],
'type' => 'key_value_json'
]
], 'POST');
$content = collect($this->query($response['result']['url']))
->mapWithKeys(function ($entry, $key) {
if ($this->skipTrimming) {
return is_array($entry) ? [array_key_first($entry) => array_pop($entry)] : [$key => $entry];
}
return is_array($entry) ? [trim(array_key_first($entry)) => array_pop($entry)] : [$key => trim($entry)];
})
->sortKeys()
->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
file_put_contents(app()->langPath() . DIRECTORY_SEPARATOR . $language['code'] . '.json', $content);
});
return $languages->pluck('code');
}
public function syncTerms(): void
{
try {
$this->setupPoeditorCredentials();
$entries = $this->getFileContent()
->map(function ($value, $key) {
return ['term' => $key];
})
->toJson();
$this->query('https://api.poeditor.com/v2/projects/sync', [
'form_params' => [
'api_token' => $this->apiKey,
'id' => $this->projectId,
'data' => $entries,
]
], 'POST');
} catch (Exception $e) {
throw $e;
}
}
public function addTerms(): void
{
try {
$this->setupPoeditorCredentials();
$entries = $this->getFileContent()
->map(function ($value, $key) {
return ['term' => $key];
})
->toJson();
$this->query('https://api.poeditor.com/v2/terms/add', [
'form_params' => [
'api_token' => $this->apiKey,
'id' => $this->projectId,
'data' => $entries,
]
], 'POST');
} catch (Exception $e) {
throw $e;
}
}
public function syncTranslations(?array $languages = null): void
{
try {
$this->setupPoeditorCredentials();
$translations = $this->getTranslations($languages);
foreach ($translations as $language => $entries) {
$json = collect($entries)
->mapToGroups(static function ($value, $key) {
return [[
'term' => $key,
'translation' => [
'content' => $value,
],
]];
})
->first()
->toJson();
$this->query('https://api.poeditor.com/v2/translations/update', [
'form_params' => [
'api_token' => $this->apiKey,
'id' => $this->projectId,
'language' => $language,
'data' => $json,
]
], 'POST');
}
} catch (Exception $e) {
throw $e;
}
}
protected function setupPoeditorCredentials(): void
{
if (!$this->apiKey = config('translation.api_key')) {
throw POEditorException::noApiKey();
}
if (!$this->projectId = config('translation.project_id')) {
throw POEditorException::noProjectId();
}
}
protected function getFileContent(): Collection
{
return file_exists($this->baseFilename)
? collect(json_decode(file_get_contents($this->baseFilename), true))
: collect();
}
protected function getTranslations(?array $languages = null): Collection
{
$namePattern = '*.json';
if ($languages !== null) {
$namePattern = '/(' . implode('|', $languages) . ').json/';
}
return collect(app(Finder::class)
->in(app()->langPath())
->name($namePattern)
->files())
->mapWithKeys(function (SplFileInfo $file) {
return [$file->getBaseName('.json') => json_decode($file->getContents(), true)];
});
}
protected function query($url, $parameters = [], $type = 'GET'): ?array
{
try {
$response = app(Client::class)->request($type, $url, $parameters);
return $this->handleResponse($response);
} catch (POEditorException $e) {
throw POEditorException::communicationError($e->getMessage());
} catch (GuzzleException $e) {
throw POEditorException::communicationError($e->getMessage());
}
}
protected function handleResponse(GuzzleResponse $response)
{
if (!in_array($response->getStatusCode(), [Response::HTTP_OK, Response::HTTP_CREATED], true)) {
throw POEditorException::communicationError($response->getBody()->getContents());
}
return json_decode($response->getBody()->getContents(), true);
}
}
| php | MIT | 6bec99ffd1a5da6c1e53e3732203dd2c701b4aaa | 2026-01-05T05:03:46.176465Z | false |
vemcogroup/laravel-translation | https://github.com/vemcogroup/laravel-translation/blob/6bec99ffd1a5da6c1e53e3732203dd2c701b4aaa/src/Exceptions/POEditorException.php | src/Exceptions/POEditorException.php | <?php
namespace Vemcogroup\Translation\Exceptions;
use Exception;
class POEditorException extends Exception
{
public static function noApiKey(): self
{
return new static('Missing POEDITOR_API_KEY, please add it in .env');
}
public static function noProjectId(): self
{
return new static('Missing POEDITOR_PROJECT_ID, please add it in .env');
}
public static function communicationError($message): self
{
return new static('Error in communication with POEditor: ' . $message);
}
public static function unableToCreateJsDirectory($directory): self
{
return new static('Unable to create directory "' . $directory .'", please check permissions');
}
}
| php | MIT | 6bec99ffd1a5da6c1e53e3732203dd2c701b4aaa | 2026-01-05T05:03:46.176465Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.