Class 'Ical' not found
Hello, Ive installed the package via composer and included in my Laravel app but I'm getting this error.
local.ERROR: Class 'Ical' not found
I verified that the package is in my /vendor directory. I pulled it into the file that calls it via 'use Ical\Ical'
here is where the error fires...
$ical = (new Ical())->setAddress($details->meeting_location) <---- errors here ->setDateStart(new \DateTime($details->meeting_start)) ->setDateEnd(new \DateTime($meet_end)) ->setDescription($details->meeting_goal) ->setSummary($details->meeting_title) ->setOrganizer($organizer->email) ->setFilename(uniqid()); $ical->addHeader();
I have also tried \Ical\Ical but same error.
Any ideas?
Thanks!
Comments (23)
-
repo owner -
repo owner Please copy/past your file in the post
-
reporter Thanks for the quick reply. I already have that...
" I pulled it into the file that calls it via 'use Ical\Ical' "
<?php namespace App\Notifications; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Notification; use Illuminate\Notifications\Messages\MailMessage; use Ical\Ical; class SendMeetingInvite extends Notification { use Queueable; protected $meeting; /** * Create a new notification instance. * * @param $meeting */ public function __construct($meeting) { $this->meeting = $meeting; } /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return ['mail']; } /** * Get the mail representation of the notification. * * @param mixed $notifiable * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail($notifiable) { $organizer = $this->meeting->organizer; $details = $this->meeting; $meet_end = date('Y-m-d H:i:s',strtotime('+1 hour',strtotime($details->meeting_start))); $ical = (new Ical())->setAddress($details->meeting_location) ->setDateStart(new \DateTime($details->meeting_start)) ->setDateEnd(new \DateTime($meet_end)) ->setDescription($details->meeting_goal) ->setSummary($details->meeting_title) ->setOrganizer($organizer->email) ->setFilename(uniqid()); $ical->addHeader(); return (new MailMessage) ->from($organizer->email, $organizer->first_name.' '.$organizer->last_name) ->subject('Meeting, '. $this->meeting->project->ProjectName . ' Topic: ' . $this->meeting->meeting_title) ->markdown('emails.meeting-invite', compact('organizer', 'details')) ->attachData($ical->getICAL(), 'invite.ics', [ 'mime' => 'text/calendar; method=REQUEST; charset=UTF-8' ]); } /** * Get the array representation of the notification. * * @param mixed $notifiable * @return array */ public function toArray($notifiable) { return [ // ]; } }
-
repo owner If you
$ical->addHeader();
The script is stopped because your send an header, dont send and test...
-
repo owner your create a string from date() function and after your transform that in \DateTime() object... ...that not very efficient
$meet_end = date('Y-m-d H:i:s',strtotime('+1 hour',strtotime($details->meeting_start)));
-
repo owner can you send me the content of
$ical = (new Ical()) ;
in var_dump(); please.
-
reporter Sure... thank you very much for you assistance. Give me just a moment.
-
reporter Even that produces the Ical\Ical not found error.
-
repo owner the class has no probleme :)
-
repo owner Can you add a try{} catch ... and send me content of
$exc->getMessage;
-
reporter Same error :(
-
reporter I created a new file to test the class with your example and still get the same error
<?php namespace App\Http\Controllers; use Ical\Ical; class Test extends Controller { public function test() { try { $ical = (new Ical())->setAddress('Paris') ->setDateStart(new \DateTime('2014-11-21 15:00:00')) ->setDateEnd(new \DateTime('2014-11-21 16:00:00')) ->setDescription('wonder description') ->setSummary('Running') ->setOrganizer('foo@bar.fr') //optional ->setFilename(uniqid()); $ical->addHeader(); echo $ical->getICAL(); } catch (\Exception $exec) { return $exec->getMessage(); } } }
-
repo owner Please reload from composer... send... composer update.
-
reporter kbrown@WWW001:/var/www/html$ composer require "calendar/icsfile": "dev-master"
[InvalidArgumentException] Could not find a matching version of package dev-master. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
kbrown@WWW001:/var/www/html$ composer require "calendar/icsfile" Using version ^4.0 for calendar/icsfile ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 1 install, 0 updates, 0 removals - Installing calendar/icsfile (4.0.1): Loading from cache Writing lock file Generating optimized autoload files
Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover Discovered Package: fideloper/proxy Discovered Package: barryvdh/laravel-debugbar Discovered Package: laravelcollective/html Discovered Package: laravel/tinker Package manifest generated successfully. kbrown@WWW001:/var/www/html$
-
repo owner it better if un use an explicit version :
composer require "calendar/icsfile": "^4.0"
-
repo owner dev-master is not stable... " Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable)".
-
reporter when I specify with composer require "calendar/icsfile": "dev-master"
[InvalidArgumentException] Could not find a matching version of package dev-master. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
-
repo owner minimum-stability (stable)
composer require "calendar/icsfile": "^4.0" is stable not "dev-master"
-
reporter hmmm
composer require "calendar/icsfile": "^4.0"
[InvalidArgumentException] Could not find a matching version of package ^4.0. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (stable).
-
repo owner Post your composer.json please
-
reporter { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=7.0.0", "barryvdh/laravel-debugbar": "^3.1", "calendar/icsfile": "^4.0", "cerbero/query-filters": "^1.3", "doctrine/dbal": "^2.6", "fideloper/proxy": "~3.3", "laravel/framework": "5.5.*", "laravel/tinker": "~1.0", "laravelcollective/html": "^5.4.0", "league/csv": "^9.0", "league/flysystem-aws-s3-v3": "^1.0", "nesbot/carbon": "^1.22" }, "require-dev": { "filp/whoops": "~2.0", "fzaninotto/faker": "~1.4", "laracasts/generators": "^1.1", "mockery/mockery": "0.9.*", "phpunit/phpunit": "~6.0" }, "autoload": { "classmap": [ "database/seeds", "database/factories" ], "psr-4": { "App\\": "app/" } }, "autoload-dev": { "psr-4": { "Tests\\": "tests/" } }, "extra": { "laravel": { "dont-discover": [ ] } }, "scripts": { "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate" ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", "@php artisan package:discover" ] }, "config": { "preferred-install": "dist", "sort-packages": true, "optimize-autoloader": true } }
-
repo owner The problem is on your side, i'm sorry.
Command: composer install Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 88 installs, 0 updates, 0 removals - Installing symfony/finder (v3.4.4): Loading from cache - Installing psr/log (1.0.2): Downloading (100%) - Installing symfony/debug (v3.4.4): Downloading (100%) - Installing symfony/polyfill-mbstring (v1.7.0): Downloading (100%) - Installing symfony/var-dumper (v3.4.4): Loading from cache - Installing maximebf/debugbar (v1.14.1): Downloading (100%) - Installing vlucas/phpdotenv (v2.4.0): Downloading (100%) - Installing symfony/css-selector (v4.0.4): Downloading (100%) - Installing tijsverkoyen/css-to-inline-styles (2.2.1): Downloading (100%) - Installing symfony/routing (v3.4.4): Loading from cache - Installing symfony/process (v3.4.4): Downloading (100%) - Installing paragonie/random_compat (v2.0.11): Loading from cache - Installing symfony/polyfill-php70 (v1.7.0): Downloading (100%) - Installing symfony/http-foundation (v3.4.4): Loading from cache - Installing symfony/event-dispatcher (v4.0.4): Downloading (100%) - Installing symfony/http-kernel (v3.4.4): Downloading (100%) - Installing symfony/console (v3.4.4): Downloading (100%) - Installing doctrine/lexer (v1.0.1): Downloading (100%) - Installing egulias/email-validator (2.1.3): Loading from cache - Installing swiftmailer/swiftmailer (v6.0.2): Loading from cache - Installing ramsey/uuid (3.7.3): Downloading (100%) - Installing psr/simple-cache (1.0.0): Downloading (100%) - Installing psr/container (1.0.0): Downloading (100%) - Installing symfony/translation (v3.4.4): Downloading (100%) - Installing nesbot/carbon (1.22.1): Downloading (100%) - Installing mtdowling/cron-expression (v1.2.1): Downloading (100%) - Installing monolog/monolog (1.23.0): Downloading (100%) - Installing league/flysystem (1.0.42): Downloading (100%) - Installing erusev/parsedown (1.6.4): Downloading (100%) - Installing doctrine/inflector (v1.3.0): Loading from cache - Installing laravel/framework (v5.5.33): Downloading (100%) - Installing barryvdh/laravel-debugbar (v3.1.0): Downloading (100%) - Installing calendar/icsfile (4.0.1): Loading from cache - Installing cerbero/query-filters (1.3.1): Downloading (100%) - Installing doctrine/collections (v1.5.0): Loading from cache - Installing doctrine/cache (v1.7.1): Loading from cache - Installing doctrine/annotations (v1.6.0): Loading from cache - Installing doctrine/common (v2.8.1): Loading from cache - Installing doctrine/dbal (v2.6.3): Loading from cache - Installing fideloper/proxy (3.3.4): Downloading (100%) - Installing jakub-onderka/php-console-color (0.1): Downloading (100%) - Installing jakub-onderka/php-console-highlighter (v0.3.2): Downloading (100%) - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%) - Installing nikic/php-parser (v3.1.4): Loading from cache - Installing psy/psysh (v0.8.17): Downloading (100%) - Installing laravel/tinker (v1.0.3): Downloading (100%) - Installing laravelcollective/html (v5.5.1): Downloading (100%) - Installing league/csv (9.1.2): Downloading (100%) - Installing mtdowling/jmespath.php (2.4.0): Downloading (100%) - Installing psr/http-message (1.0.1): Loading from cache - Installing guzzlehttp/psr7 (1.4.2): Loading from cache - Installing guzzlehttp/promises (v1.3.1): Loading from cache - Installing guzzlehttp/guzzle (6.3.0): Loading from cache - Installing aws/aws-sdk-php (3.52.2): Downloading (100%) - Installing league/flysystem-aws-s3-v3 (1.0.18): Downloading (100%) - Installing filp/whoops (2.1.14): Downloading (100%) - Installing fzaninotto/faker (v1.7.1): Loading from cache - Installing laracasts/generators (1.1.4): Downloading (100%) - Installing hamcrest/hamcrest-php (v1.2.2): Downloading (100%) - Installing mockery/mockery (0.9.9): Downloading (100%) - Installing sebastian/version (2.0.1): Loading from cache - Installing sebastian/resource-operations (1.0.0): Loading from cache - Installing sebastian/recursion-context (3.0.0): Loading from cache - Installing sebastian/object-reflector (1.1.1): Loading from cache - Installing sebastian/object-enumerator (3.0.3): Loading from cache - Installing sebastian/global-state (2.0.0): Loading from cache - Installing sebastian/exporter (3.1.0): Loading from cache - Installing sebastian/environment (3.1.0): Loading from cache - Installing sebastian/diff (2.0.1): Loading from cache - Installing sebastian/comparator (2.1.3): Downloading (100%) - Installing doctrine/instantiator (1.1.0): Loading from cache - Installing phpunit/php-text-template (1.2.1): Loading from cache - Installing phpunit/phpunit-mock-objects (5.0.6): Loading from cache - Installing phpunit/php-timer (1.0.9): Loading from cache - Installing phpunit/php-file-iterator (1.4.5): Loading from cache - Installing theseer/tokenizer (1.1.0): Loading from cache - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache - Installing phpunit/php-token-stream (2.0.2): Loading from cache - Installing phpunit/php-code-coverage (5.3.0): Loading from cache - Installing webmozart/assert (1.3.0): Downloading (100%) - Installing phpdocumentor/reflection-common (1.0.1): Loading from cache - Installing phpdocumentor/type-resolver (0.4.0): Loading from cache - Installing phpdocumentor/reflection-docblock (4.3.0): Downloading (100%) - Installing phpspec/prophecy (1.7.3): Loading from cache - Installing phar-io/version (1.0.1): Loading from cache - Installing phar-io/manifest (1.0.1): Loading from cache - Installing myclabs/deep-copy (1.7.0): Loading from cache - Installing phpunit/phpunit (6.5.6): Downloading (100%) symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump) symfony/var-dumper suggests installing ext-symfony_debug () maximebf/debugbar suggests installing kriswallsmith/assetic (The best way to manage assets) maximebf/debugbar suggests installing predis/predis (Redis storage) symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader) symfony/routing suggests installing symfony/dependency-injection (For loading routes from a service) symfony/routing suggests installing symfony/expression-language (For using expression matching) symfony/routing suggests installing symfony/yaml (For using the YAML loader) paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.) symfony/event-dispatcher suggests installing symfony/dependency-injection () symfony/http-kernel suggests installing symfony/browser-kit () symfony/http-kernel suggests installing symfony/config () symfony/http-kernel suggests installing symfony/dependency-injection () symfony/console suggests installing symfony/lock () egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation) ramsey/uuid suggests installing ircmaxell/random-lib (Provides RandomLib for use with the RandomLibAdapter) ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator) ramsey/uuid suggests installing ext-uuid (Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator) ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).) ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.) ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid) symfony/translation suggests installing symfony/config () symfony/translation suggests installing symfony/yaml () monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server) monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required)) monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server) monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server) monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver) monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib) monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome) monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar) monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server) monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server) league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2) league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage) league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching) league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem) league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files) league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib) league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage) league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter) league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage) league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications) laravel/framework suggests installing ext-pcntl (Required to use all features of the queue worker.) laravel/framework suggests installing ext-posix (Required to use all features of the queue worker.) laravel/framework suggests installing league/flysystem-cached-adapter (Required to use Flysystem caching (~1.0).) laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (~1.0).) laravel/framework suggests installing nexmo/client (Required to use the Nexmo transport (~1.0).) laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (~3.0).) laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (~1.0).) laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (~3.0).) laravel/framework suggests installing symfony/dom-crawler (Required to use most of the crawler integration testing tools (~3.3).) laravel/framework suggests installing symfony/psr-http-message-bridge (Required to psr7 bridging features (~1.0).) doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver) psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :)) psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.) psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.) psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.) aws/aws-sdk-php suggests installing aws/aws-php-sns-message-validator (To validate incoming SNS notifications) filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses) sebastian/global-state suggests installing ext-uopz (*) phpunit/phpunit suggests installing phpunit/php-invoker (^1.1) Writing lock file Generating optimized autoload files [RuntimeException] Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...
-
repo owner - changed status to resolved
- Log in to comment
Hi, Add
at the head of your file...