Search code examples
phpcomposer-phpcodeigniter-4

Could not open input file: spark


I use PHP v8.1 and I'm trying to open Codeigniter (v4.2.10) welcome page using the command: php spark serve and I get this error: Could not open input file: spark.

I've searched the internet and couldn't find anything related. So I tried to install spark by using composer as : composer require sparkphp/spark but no luck. I got the following error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires sparkphp/spark ^0.16.3 -> satisfiable by sparkphp/spark[0.16.3].
    - sparkphp/spark 0.16.3 requires destrukt/destrukt ^0.7.1 -> could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require sparkphp/spark:*" to figure out if any version is installable, or "composer require sparkphp/spark:^2.1" if you know which you need.

Installation failed, deleting ./composer.json.

Now I don't have any idea what should I do and I appreciate any help.


Solution

  • Could not open input file: spark
    

    means that you are not in the Codeigniter root directory. just go to Codeigniter root directory then run the command. if you use composer to create the app

    composer create-project codeigniter4/appstarter project-root
    

    just go to the 'project-root' (any name you wrote)

    cd project-root
    php spark serve