如何避免丑陋的作曲家地狱的文件夹?

时间:2016-12-08 16:11:35

标签: php architecture composer-php

...问题是关于use子句的位置和路径,在projetc/src我运行composer require jenssegers/imagehash的{​​{1}}文件夹中我现在ls

composer.json  composer.lock   sync.php  
/vendor
  autoload.php  
  /composer 
  /jenssegers
       /imagehash
          composer.json  README.md  
          /src
              ImageHash.php  Implementation.php  /Implementations

他们,在我的项目文件夹中,我运行php sync.php ...错误

PHP致命错误:未捕获错误:未找到类'Jenssegers \ ImageHash \ ImageHash'

如何解决? ... 如何使用KISSConvention over configuration原则正确组织或安装所有文件夹

sync.php我有PHP代码,

use Jenssegers\ImageHash\ImageHash;  // after composer update
$hasher = new ImageHash;
die("\ndebug\n");

1 个答案:

答案 0 :(得分:1)

添加

import React from 'react'
import { connect } from 'react-redux'
import { addTodo } from '../actions'

let AddTodo = ({ dispatch }) => {
let input

return (
  <div>
    <form onSubmit={e => {
      e.preventDefault()
      if (!input.value.trim()) {
        return
      }
      dispatch(addTodo(input.value))
      input.value = ''
    }}>
      <input ref={node => {
        input = node
      }} />
      <button type="submit">
        Add Todo
      </button>
    </form>
  </div>
 )
}

AddTodo = connect()(AddTodo)

export default AddTodo

require __DIR__ . '/vendor/autoload.php'; 。您可以阅读更多相关信息here